Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris

Re^4: Odd error message

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

in reply to Re^3: Odd error message
in thread Odd error message

The issue is that the module got an NV, not a UV, IV, or numerical string. Sure, it can convert it, but it will probably not be what the caller intended. The source for almost all functions call _validate_int() on inputs, which is where the error message occurs.

Edit: The value it dies on for me has exceeded 64 bits, so there is no way the module would get the intended input. Better to die than give a wrong answer.

In theory to work with larger inputs, we should be doing the input calcs as BigInt (or Math::GMP or Math::GMPz, etc.) to make sure they're correct and scale past 64-bit, then do the gap/log($num) making sure the inputs are BigFloat.

The reason we wouldn't want to let $num be an NV for the log calc is that these scripts should scale to $num values of 20k+ digits, which won't fit in a double or long double.

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (4)
As of 2022-01-19 15:12 GMT
Find Nodes?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:

    Results (55 votes). Check out past polls.