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

Re: Decimal numbers calculations done inconsistently: Odd behavior!

by atcroft (Abbot)
on Mar 19, 2015 at 15:40 UTC ( [id://1120602]=note: print w/replies, xml ) Need Help??


in reply to Decimal numbers calculations done inconsistently: Odd behavior!

Your basic problem is that computers use representations of powers of 2 (even for fractional values), but not every fractional number can be represented accurately as such. For more information, a resource such as What Every Computer Scientist Should Know About Floating-Point Arithmetic or the link to which LanX response referred would be a good start.

As to a solution/fix, toolic's referred would be good starting places to look.

Hope that helps.

  • Comment on Re: Decimal numbers calculations done inconsistently: Odd behavior!

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (3)
As of 2024-04-24 21:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found