in reply to Operations with Extremely Large Numbers
The problem is that your are trying to use the exlusive-or operator ^ to perform exponentiation **.
This works:
use Math::Trig; use bignum; sub factorial { my $n = @_; my $root = sqrt($n*2*pi); my $exp = ($n/exp(1)) ** $n; my $result =$root*$exp; return $result; } my $b = 2032597; my $r = Math::BigInt->new(factorial($b)); print "b is $b\n"; print "the calculated result is $r\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Operations with Extremely Large Numbers
by BrowserUk (Patriarch) on Nov 09, 2011 at 18:14 UTC | |
by jjw017 (Initiate) on Nov 09, 2011 at 18:36 UTC | |
by jethro (Monsignor) on Nov 11, 2011 at 10:44 UTC |