[GHC] #13232: Undeflow/overflow for floating-point values

GHC ghc-devs at haskell.org
Sat Feb 4 19:56:34 UTC 2017


#13232: Undeflow/overflow for floating-point values
-------------------------------------+-------------------------------------
           Reporter:  lerkok         |             Owner:
               Type:  feature        |            Status:  new
  request                            |
           Priority:  normal         |         Milestone:
          Component:  Compiler       |           Version:  8.0.1
           Keywords:                 |  Operating System:  Unknown/Multiple
       Architecture:                 |   Type of failure:  None/Unknown
  Unknown/Multiple                   |
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 GHC nicely prints overflow for bounded types:

 {{{#!hs
 Prelude Data.Word> 232312::Word8

 <interactive>:2:1: warning: [-Woverflowed-literals]
     Literal 232312 is out of the Word8 range 0..255
 120
 }}}

 But the same courtesy isn't currently extended to floats:

 {{{
 Prelude Data.Word> 1e5000 :: Float
 Infinity
 Prelude Data.Word> 1e-5000 :: Double
 0.0
 }}}

 It would be nice if overflow/underflow warnings were issued for floats as
 well. Note that with the hexadecimal floats proposal
 (https://github.com/LeventErkok/ghc-
 proposals/blob/hexFloats/proposals/0000-hexFloats.rst) this would be
 especially nice, making GHC a very fine platform for numeric computations.

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


More information about the ghc-tickets mailing list