Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight

Re: Why does perl math suck?

by tilly (Archbishop)
on Jan 29, 2011 at 15:39 UTC ( #885026=note: print w/ replies, xml ) Need Help??

in reply to Why does perl math suck?

perl -le 'print 5056.45 + 10112.92 eq 15169.37 ? "as expected" : "perl math sucks!"'
works as expected. The reason is that Perl uses more digits in floating point calculations than it stringifies, so stringification rounds off to the expected number. (I didn't invent this trick.)

Comment on Re: Why does perl math suck?
Download Code

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (6)
As of 2015-11-26 04:32 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (696 votes), past polls