Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Answer: My floating point comparison does not work. Why ?

by TedPride (Priest)
on Oct 30, 2004 at 23:22 UTC ( #404070=categorized answer: print w/replies, xml ) Need Help??

Q&A > math > My floating point comparison does not work. Why ? - Answer contributed by TedPride

You should also note that while floating point numbers won't be exact, two numbers arrived at through the same calculation (4 / 7, for instance) will be the same. This means that under some conditions, rounding isn't necessary - and under others, a simple fraction class is probably going to be better than trying to approximate comparisons.

  • Comment on Answer: My floating point comparison does not work. Why ?
Log In?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (7)
As of 2021-01-18 07:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?