#7069: precision/rounding bug with floating point numbers on 32-bit-platforms
-----------------------------------------+----------------------------------
Reporter: shahn | Owner:
Type: bug | Status: new
Priority: normal | Component: Compiler
Version: 7.4.2 | Keywords: Float Double 32
precision rounding
Os: Unknown/Multiple | Architecture: x86
Failure: Incorrect result at runtime | Testcase:
Blockedby: | Blocking:
Related: |
-----------------------------------------+----------------------------------
Comparing floating point numbers (Floats or Doubles, using (==)) that are
constructed by equal terms sometimes evaluates to False. A term that
produces normal floating point values (as opposed to NaN or Infinity)
should always be equal to itself. This bug effectively breaks referential
transparency.
This bug occurs with ghc-7.4.2 when compiling with "-O2" on 32-bit linux
ubuntu-11.10. (I guess, it happens on all 32-bit platforms.)
The attached file demonstrates the bug.
Simon Marlow expressed his doubts, this bug will be fixed. See also:
http://www.haskell.org/pipermail/glasgow-haskell-
users/2012-July/thread.html#22565
Possible workarounds:
* compile with "-msse2" if available
* use approximate equivalence
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/7069>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs