Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: float values and operators

by itub (Priest)
on Aug 11, 2004 at 21:33 UTC ( [id://382102]=note: print w/replies, xml ) Need Help??


in reply to float values and operators

Rule #1 of floating-point computing in any language, not just Perl: Never compare two floating-point numbers with == or != (or expect >= et al. to work in the edge cases). Use a tolerance range instead. Other monks have already explained the cause behind this numerical imprecision.

For a detailed explanation, see Comparing floating point numbers

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://382102]
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 23:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found