[GHC] #9810: encodeFloat 1 2047 = -1024.0

GHC ghc-devs at haskell.org
Tue Nov 18 04:03:52 UTC 2014


#9810: encodeFloat 1 2047 = -1024.0
-------------------------------------+-------------------------------------
       Reporter:  luite              |                   Owner:
           Type:  bug                |                  Status:  new
       Priority:  normal             |               Milestone:
      Component:  Compiler           |                 Version:  7.9
       Keywords:                     |        Operating System:
   Architecture:  Unknown/Multiple   |  Unknown/Multiple
     Difficulty:  Unknown            |         Type of failure:
     Blocked By:                     |  None/Unknown
Related Tickets:                     |               Test Case:
                                     |                Blocking:
                                     |  Differential Revisions:
-------------------------------------+-------------------------------------
 When the following code is compiled with optimization, it prints
 `-1024.0`, without optimization the result is `Infinity`.

 {{{#!hs
 main = print ((encodeFloat 1 2047) :: Double)
 }}}

 I think this might be caused by changes in decoding doubles in `integer-
 gmp2`. While `decodeFloat` is lossy, since we can not represent
 exceptional values, `encodeFloat` should never give a different answer
 here.

 Also `cgrun044` now gives a different result when compiled with
 optimization. It was broken anyway, since it claims some values are `NaN`,
 while actually `Infinity` is printed (also with 7.8), but it used to give
 the same answer regardless of optimization with GHC 7.8

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9810>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list