[GHC] #9530: min / max do not always return a NaN when one of the arguments is NaN

GHC ghc-devs at haskell.org
Sat Aug 30 23:16:19 UTC 2014


#9530: min / max do not always return a NaN when one of the arguments is NaN
-------------------------------------+-------------------------------------
       Reporter:  jrp                |                   Owner:
           Type:  bug                |                  Status:  new
       Priority:  normal             |               Milestone:
      Component:  Prelude            |                 Version:  7.8.3
       Keywords:                     |        Operating System:  MacOS X
   Architecture:  Unknown/Multiple   |         Type of failure:  Incorrect
     Difficulty:  Easy (less than 1  |  result at runtime
  hour)                              |               Test Case:
     Blocked By:                     |                Blocking:
Related Tickets:                     |  Differential Revisions:
-------------------------------------+-------------------------------------
 I assume that this is well-known, but it tripped me up:

 {{{
 Prelude> let inf = 1/0
 Prelude> let nan = 0/0
 Prelude> min nan  inf
 Infinity
 Prelude> min inf nan
 NaN
 Prelude> min 3 nan
 NaN
 Prelude> min nan 3
 3.0
 Prelude> max nan inf
 NaN
 Prelude> max inf nan
 Infinity
 Prelude> max 3 nan
 3.0
 Prelude> max nan 3
 NaN

 }}}

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


More information about the ghc-tickets mailing list