Floating point numbers
Jump to navigation
Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
Question
Why do floating point numbers behave so strange? Why is
Prelude> compare (0/0) (0/0)
GT
Prelude> (0/0) > (0/0)
False
?
Answer
This has nothing to do with Haskell, but exclusively with the underlying implementation of floating point numbers in your system.
See for instance:
- Haskell-Cafe on 0/0 > 1 == False
- Haskell-Cafe on Why purely in haskell?