[GHC] #13232: Undeflow/overflow warnings for floating-point values (was: Undeflow/overflow for floating-point values)

GHC ghc-devs at haskell.org
Sat Feb 4 19:57:46 UTC 2017


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

@@ -1,1 +1,1 @@
- GHC nicely prints overflow for bounded types:
+ GHC nicely prints overflow warnings for bounded types:

New description:

 GHC nicely prints overflow warnings 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#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list