Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re^3: Rounding over numbers

by Laurent_R (Canon)
on Feb 15, 2016 at 07:25 UTC ( [id://1155236]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Rounding over numbers
in thread Rounding over numbers

Not very surprising, most probably floating point arithmetic inaccuracy again. When you assign 13.25 to a variable, you can't know for sure if the number stored internally will be something like 13.2499999999976 or rather something like 13.25000000000012. This will depend on the machine architecture and a few of other factors.

There may also be a difference with the libraries used. IEEE recommendation is to round the trailing "5" digit up or down depending on whether the previous digit is odd or even, but some libraries may still round up systematically.

Can you perhaps try again with 1325/100 to see if it makes a difference?

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (4)
As of 2024-03-29 10:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found