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

GHC ghc-devs at haskell.org
Mon Oct 23 14:49:25 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 svenpanne):

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


Comment:

 Shortening like this would be wrong, because it would lose precision:

 {{{
 Prelude> decodeFloat ((16.0/0.00002)**2.1)
 (5102921940679704,-11)
 Prelude> decodeFloat 2.49166110385e12
 (5102921940684800,-11)
 }}}

 The default `Show` instance should at least produce as many digits as
 necessary to reproduce the underlying binary representation, otherwise a
 lot of code out there would be ''very'' unhappy. If you have other
 formatting needs, you can use e.g. `Text.Printf.printf`.

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


More information about the ghc-tickets mailing list