[GHC] #12611: expression calculation error

GHC ghc-devs at haskell.org
Fri Sep 23 10:48:20 UTC 2016


#12611: expression calculation error
-----------------------------+----------------------------------------
        Reporter:  Tom       |                Owner:
            Type:  bug       |               Status:  closed
        Priority:  normal    |            Milestone:
       Component:  Compiler  |              Version:  8.0.1
      Resolution:  invalid   |             Keywords:
Operating System:  Windows   |         Architecture:  Unknown/Multiple
 Type of failure:  Other     |            Test Case:
      Blocked By:            |             Blocking:
 Related Tickets:            |  Differential Rev(s):
       Wiki Page:            |
-----------------------------+----------------------------------------
Changes (by hsyl20):

 * status:  new => closed
 * resolution:   => invalid


Comment:

 This is a precision issue with Double numbers:
 {{{
 > 2^21-exp(21*log(2)) :: Double
 0.0
 > 2^22-exp(22*log(2)) :: Double
 -9.313225746154785e-10
 > 2^22 :: Double
 4194304.0
 > exp(22*log(2)) :: Double
 4194304.000000001
 }}}

 You get the same result with other languages:
 {{{
 php > echo (20**65 - exp(65*log(20))) ;
 6.1252998827766E+70
 }}}

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


More information about the ghc-tickets mailing list