Jump to content

eulers constant


LimeSeed
 Share

Recommended Posts

how would i get around the maximum number of decimals used in an int (i think it is 15) in order to calculate eulers constant to lets say 1000 digits? right now my code looks as such, i tried bigint but it didnt work too well, is there any way i can use arrays? if i set the number at the end of the for loop too high the msgbox just says 1.#INF since the value is too large.

$e = 0
$fin = 0

for $i = 0 to 100 step 1 ;can change 100 to whatever you like
    $fin = ((2*$i)+2)/_Factorial((2*$i)+1)
    $e += $fin
Next

msgbox(0, "e", $e)

Func _Factorial($mfFactor)
    If $mfFactor = 0 Then Return 1
    Dim $return = 1
    For $i = $mfFactor to 1 Step - 1
        $return *= $i
    Next
    Return $return
EndFunc
global $warming = true
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...