我正在尝试运行一些具有较大值的数学公式,因此我正在使用Double
数据类型。但是,如果我输入较大的值,我仍然会得到 NaN 的答案。那么我该如何解决呢?
例如,如果我通过 Varx=3 和 countx=1230,我得到的结果是 NaN。
Public Function EulerForPro(ByVal Varx As Integer, ByVal Countx As Integer) As Double
Dim Result1 As Double = 1
Dim Result2 As Double = Varx
Dim Result As Double = 0
For i = 1 To Countx
Result1 = Result1 + (Math.Pow(-1, i) * Math.Pow(Varx, (2 * i)) / factx(2 * i))
Next
For i = 1 To Countx
Result2 = Result2 + (Math.Pow(-1, i) * Math.Pow(Varx, ((2 * i) + 1)) / factx((2 * i) + 1))
Next
Result = Result1 + Result2
Label2.Text = Result1
Label3.Text = Result2
Label4.Text = Result
End Function