Make sure you give it a while to run. It hangs for over three minutes just computing $e for me on OS X (Mac Pro late 2013 sitting otherwise idle) but does eventually produce an answer. These are hyoooooge numbers (checking with Wolfram Alpha which shows they're on the order of 10**6889) and I'm going to guess that it's just CPU bound.
$ time perl -MLog::Log4perl=:easy -Mbignum -E 'Log::Log4perl->easy_ini +t($DEBUG);$|=1;INFO(qq{before});my $z = -15863.8668285308; INFO(qq{z: + }, $z); my $e = exp( $z * -1 ); INFO(qq{e: }, $e); my $p = 1.0/$e;IN +FO(qq{p: }, $p);INFO(qq{DONE});' 2020/08/30 16:29:11 before 2020/08/30 16:29:11 z: -15863.8668285308 2020/08/30 16:32:45 e: 38888865970354639568651511148772888670670000000 +000000000000000000000000000000[boatload o 0s] 2020/08/30 16:32:45 p: 0.0[boatload o 0s]00025714300868590761106006809 +94899649646402 2020/08/30 16:32:45 DONE perl -MLog::Log4perl=:easy -Mbignum -E 214.12s user 0.15s system 99% + cpu 3:34.33 total
Edit: added missing phrase
Update: If you install a faster math library, e.g. Math::BigInt::GMP and make sure that's used (add a line use Math::BigFloat lib => q{GMP};), then this returns immediately. The problem is most likely the default pure Perl bignum implementation Math::BigInt::Calc.
The cake is a lie.
The cake is a lie.
The cake is a lie.
In reply to Re: exp() bignum issue
by Fletch
in thread exp() bignum issue
by cormanaz
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |