[GHC] #7069: precision/rounding bug with floating point numbers on 32-bit-platforms
GHC
cvs-ghc at haskell.org
Mon Jul 16 11:20:33 CEST 2012
#7069: precision/rounding bug with floating point numbers on 32-bit-platforms
------------------------------------------+---------------------------------
Reporter: shahn | Owner: simonmar
Type: bug | Status: closed
Priority: normal | Milestone: 7.6.1
Component: Compiler | Version: 7.4.2
Resolution: wontfix | Keywords: Float Double 32 precision rounding
Os: Unknown/Multiple | Architecture: x86
Failure: Incorrect result at runtime | Difficulty: Unknown
Testcase: | Blockedby:
Blocking: | Related:
------------------------------------------+---------------------------------
Comment(by maeder):
Maybe it is enough that (true) floating point arithmetic yields non-
deterministic results.
The problem here regards equality, which need not be the same as "a - b ==
0". So if we implement
{{{
a == b = show a == show b
}}}
(or more efficiently using rounding)
then this better reflects the data model, i.e. for set instances (and the
expected behavior for this ticket).
Yet, almost all number laws are broken, i.e.
{{{
a == b ==> a - b == 0
}}}
But maybe this is more acceptable (with a broken FPU).
The difference between the "equal" values 0.65999289 and 0.65999289 (of
the given example) happens to be 5.551115123125783e-17 (so is clearly
visible as Double).
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/7069#comment:7>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the Glasgow-haskell-bugs
mailing list