[GHC] #14384: real numbers, digits after the decimal point - digits of precision

GHC ghc-devs at haskell.org
Mon Oct 23 16:24:23 UTC 2017


#14384: real numbers, digits after the decimal point - digits of precision
-------------------------------------+-------------------------------------
        Reporter:  vanto             |                Owner:  (none)
            Type:  feature request   |               Status:  closed
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.2.1
      Resolution:  invalid           |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------
Changes (by hsyl20):

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


Comment:

 Replying to vanto:

 It seems like you are new to Haskell (and to programming with floating-
 point numbers in general). `read . show` must be `id`. Do you understand
 the following code?

 {{{#!hs
 > read (show ((16.0/0.00002)**2.1)) - (((16.0/0.00002)**2.1) :: Double)
 0.0
 > read "2.49166110385e12" - (((16.0/0.00002)**2.1) :: Double)
 2.48828125
 }}}

 Use `printf` as suggested or
 [https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/ghci.html#using-a
 -custom-interactive-printing-function `-interactive-print` in GHCi].

 Please use the haskell-beginners mailing-list to ask questions instead of
 GHC's bug tracker when you don't understand. You are not alone here.

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


More information about the ghc-tickets mailing list