[GHC] #7460: Double literals generated bad core
GHC
cvs-ghc at haskell.org
Thu Nov 29 23:38:31 CET 2012
#7460: Double literals generated bad core
---------------------------------+------------------------------------------
Reporter: tibbe | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 7.4.2
Keywords: | Os: Unknown/Multiple
Architecture: Unknown/Multiple | Failure: Runtime performance bug
Difficulty: Unknown | Testcase:
Blockedby: | Blocking:
Related: |
---------------------------------+------------------------------------------
Changes (by daniel.is.fischer):
* cc: daniel.is.fischer@… (added)
Comment:
While we have no real `word2Double#`, would
{{{
{-# RULES
"fromIntegral/Word->Double" fromIntegral = word2Double
#-}
correction :: Double
correction = 2 * int2Double minBound
word2Double :: Word -> Double
word2Double w = case fromIntegral w of
i | i < 0 -> int2Double i - correction
| otherwise -> int2Double i
}}}
(and similar for `Float`) be an acceptable stand-in?
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/7460#comment:4>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the Glasgow-haskell-bugs
mailing list