[GHC] #15081: Finite list becomes infinite after maping fractional function for high numbers

GHC ghc-devs at haskell.org
Wed Apr 25 14:54:54 UTC 2018


#15081: Finite list becomes infinite after maping fractional function for high
numbers
-------------------------------------+-------------------------------------
        Reporter:  Onsed             |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:  8.6.1
       Component:  Compiler          |              Version:  8.2.2
      Resolution:                    |             Keywords:
Operating System:  Linux             |         Architecture:  x86_64
 Type of failure:  Incorrect result  |  (amd64)
  at runtime                         |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by svenpanne):

 Hmmm, even with the improved instances, aren't we just shifting the
 problem by one bit? The underlying problem stays: You can write more
 precise Integers than Double can represent, and enumerating floating point
 numbers is inherently fragile. People tend to assume initially that

 {{{#!haskell
 map (/2) [9007199254740990..9007199254740991]
 }}}

 behaves like

 {{{#!haskell
 map ((/2) . fromIntegral) [9007199254740990..9007199254740991]
 }}}

 which is something different because of defaulting/typing rules.

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


More information about the ghc-tickets mailing list