[GHC] #14389: Improved results in GHCi during basic calculations

GHC ghc-devs at haskell.org
Thu Oct 26 06:31:44 UTC 2017


#14389: Improved results in GHCi during basic calculations
-------------------------------------+-------------------------------------
        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:  Other             |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------
Changes (by svenpanne):

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


Comment:

 Sorry to say, but this ticket is basically the same as your previous
 tickets #14377 and #14384. The bottom line is: The floating point
 numbers/operations available on normal HW are fundamentally different from
 the usual numbers/operations from math. If you want to understand the
 details, please have a look at ''the'' paper in this area "What Every
 Computer Scientist Should Know About Floating-Point Arithmetic" (available
 at e.g. http://www.validlab.com/goldberg/paper.pdf).

 Your `exp`/`log` result is therefore fully expected, and the same holds
 for the last example, although there you can calculate in a different
 domain by adding a `:: Rational` after it.

 Before opening more tickets in this area, please have a look at that paper
 first and try to understand Haskell's defaulting mechanism, too.

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


More information about the ghc-tickets mailing list