
#15271: 1e1000000000 :: Double yields 0.0 instead of Infinity -------------------------------------+------------------------------------- Reporter: claude | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: 8.8.1 Component: Compiler | Version: 8.4.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Incorrect result | Unknown/Multiple at runtime | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by fangyizhou): {{{ main = do print 1e646457008 -- This is infinity print 1e646457009 -- This incorrectly printed 0.0 print 1e1555550000 -- This is still infinity print 1e1000000000 -- This incorrectly printed 0.0 }}} This is some wraparound behaviour, which is why I thought there is an integer overflow. I used `trace` to print the value of `(I# (ln# -# ld# +# 1# -# md#))` (https://github.com/ghc/ghc/blob/21f0f56164f50844c2150c62f950983b2376f8b6/lib...) 1e646457008 -> 2147483645 (infinity) 1e646457009 -> 2147483648 (0.0, overflow to negative) 1e1000000000 -> 3321928042 (infinity, overflow to positive) 1e1555550000 -> 5167425196 (0.0, overflow to negative) Any suggestions on how to fix? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15271#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler