Hello,
There were some recent discussions on the floating point support in Haskell
and some not-so-pleasant "surprises" people encountered.

There is an Eq instance defined for these types!

So I tried this:
*Main> sqrt (10.0) ==3.1622776601683795
True
*Main> sqrt (10.0) ==3.16227766016837956
True
*Main> sqrt (10.0) ==3.1622776601683795643
True
*Main> sqrt (10.0) ==3.16227766016837956435443343
True

It seems strange.

So my doubts are:
1. I wonder how the Eq instance is defined in case of floating point types
in Haskell?
2. Can the Eq instance for floating point types be considered "meaningful"?
If yes, how?
In general, programmers are **advised** not to base conditional branching
on tests for **equality** of two floating point values.
3. Is this particular behaviour GHC specific? (I am using GHC 6.12.1)

If there are references on this please share.

Thanks and regards,
-Damodar Kulkarni
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to