[GHC] #10754: truncate /= double2Int

GHC ghc-devs at haskell.org
Sat Aug 8 08:54:13 UTC 2015


#10754: truncate /= double2Int
-------------------------------------+-------------------------------------
        Reporter:  cblp              |                   Owner:
            Type:  bug               |                  Status:  new
        Priority:  normal            |               Milestone:
       Component:  libraries/base    |                 Version:  7.10.2
      Resolution:                    |                Keywords:  truncate,
                                     |  double2Int, rewrite, rule
Operating System:  Unknown/Multiple  |            Architecture:
 Type of failure:  Incorrect result  |  Unknown/Multiple
  at runtime                         |               Test Case:
      Blocked By:                    |                Blocking:
 Related Tickets:                    |  Differential Revisions:
-------------------------------------+-------------------------------------

Comment (by cblp):

 Speaking mathematically, yes, as 1/0 is actually +infinity, nearest Int is
 maxBound, and for (-1/0) the nearest Int is minBound.

 But what is the correct answer for {{{truncate (1/0) :: Integer}}}? Now it
 is
 179769313486231590772930519078902473361797697894230657273430081157732675805500963132708477322407536021120113879871393357658789768814416622492847430639474124377767893424865485276302219601246094119453082952085005768838150682342462881473913110540827237163350510684586298239947245938479716304835356329624224137216.

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


More information about the ghc-tickets mailing list