Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Odd error message

by danaj (Friar)
on Sep 15, 2015 at 21:14 UTC ( #1142133=note: print w/replies, xml ) Need Help??


in reply to Odd error message

MPU is very strict about getting integers, as it is very easy for Perl to suddenly decide a large number is a float. This is almost always something Very Bad when doing number theory. I chose to have it complain instead of giving subtly wrong results.

One of the problems here is the merit calculation needs to be done using FP logs. This is why, if you look at my gap software, everything is a bigint except the merit calculation, done in a sub that explicitly converts to BigFloats. It's a PITA, and Perl6 / PARI are much nicer in this.

Anyway, $fact*$i could easily overflow (primorial(31)*3e8 is larger than 64-bit). You need to do something like my $fact = Math::BigInt->new(primorial(31)); to force $num to be a bigint. Then the merit calc should be done as a sub that uses Math::BigFloat.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1142133]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (2)
As of 2022-01-16 11:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:












    Results (49 votes). Check out past polls.

    Notices?