[GHC] #9534: IEEE Standard 754 for Binary Floating-Point Arithmetic by Prof. W. Kahan, UCB
GHC
ghc-devs at haskell.org
Sun Aug 31 23:18:11 UTC 2014
#9534: IEEE Standard 754 for Binary Floating-Point Arithmetic by Prof. W. Kahan,
UCB
-------------------------------------+-------------------------------------
Reporter: jrp | Owner:
Type: task | Status: new
Priority: normal | Milestone:
Component: Test Suite | Version: 7.8.3
Keywords: IEEE754 | Operating System:
Architecture: Unknown/Multiple | Unknown/Multiple
Difficulty: Moderate (less | Type of failure: Incorrect
than a day) | result at runtime
Blocked By: | Test Case:
Related Tickets: | Blocking:
| Differential Revisions:
-------------------------------------+-------------------------------------
The attached is an implementation of the floating point accuracy test
described in ''The Baleful Influence of Benchmarks'' section of
http://www.eecs.berkeley.edu/~wkahan/ieee754status/IEEE754.PDF
{{{
Results for Float:
r = 4098.0 produces 12.0 and 12.0 sig. bits
r = 4098.25 fails: root 0.99989897 isn't at least 1 <<<<
r = 4097.004 produces 12.0 and 11.999298 sig. bits
:
Worst accuracy is 11.999298 sig. bits
:
Results for Double:
r = 4098.0 produces Infinity and Infinity sig. bits
r = 4098.25 produces Infinity and 53.0 sig. bits
r = 4097.00390625 produces Infinity and 53.451178091541244 sig. bits
r = 1.6777218e7 produces Infinity and Infinity sig. bits
r = 1.677721825e7 produces Infinity and 75.0 sig. bits
r = 1.6777219e7 produces Infinity and 71.0 sig. bits
r = 9.4906267e7 produces 26.499999994288153 and 26.499999986733027 sig.
bits
r = 9.490626725e7 fails: root 0.999999995635551 isn't at least 1 <<<
r = 2.684354505e8 produces 28.0 and 27.999999919383132 sig. bits
r = 2.684354515e8 produces 28.0 and 27.99999993013205 sig. bits
r = 2.68435458e8 produces 28.0 and 28.0 sig. bits
r = 2.6843545825e8 produces 28.0 and 28.00000000268723 sig. bits
r = 2.6843545700000006e8 produces 28.0 and 27.999999989251084 sig. bits
r = 4.294967298e9 produces 32.0 and 32.0 sig. bits
r = 4.29496729825e9 produces 32.0 and 32.00000000016795 sig. bits
Worst accuracy is 26.499999986733027 sig. bits
}}}
This seems to be comparable to a clang version, but seems to be fairly
poor in comparison to some other machines, back in the day (1997).
'''The attached could, possibly be turned into a testsuite test, by
removing the QuickCheck tests that are included.'''
Observations:
* There are a couple of failures (could be the implementation of sqrt or
log).
* signum seems incorrect (signum Nan = -1.0)
* The prelude should have a copysign function
* min fails to produce the other argument if one argument is NaN
* The CFloat and CDouble variants seem to produce the same result as the
native Float and Double versions
* The Haskell coding style could be improved to remove some boilerplate,
make the code more idiomatic
* There may be a better way of entering the test values of r to ensure
that they are accurate
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9534>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list