[GHC] #7858: Fix definitions of abs/signum for Floats/Doubles

GHC ghc-devs at haskell.org
Mon Aug 4 16:14:42 UTC 2014


#7858: Fix definitions of abs/signum for Floats/Doubles
-------------------------------------+-------------------------------------
              Reporter:  lerkok      |            Owner:
                  Type:  bug         |           Status:  patch
              Priority:  normal      |        Milestone:  7.10.1
             Component:              |          Version:  7.6.3
  libraries/base                     |         Keywords:  floating point
            Resolution:              |     Architecture:  Unknown/Multiple
      Operating System:              |       Difficulty:  Unknown
  Unknown/Multiple                   |       Blocked By:
       Type of failure:              |  Related Tickets:  #9238
  None/Unknown                       |
             Test Case:              |
              Blocking:              |
Differential Revisions:              |
-------------------------------------+-------------------------------------

Comment (by rwbarton):

 Actually, how about this for signum?
 {{{
 signum :: Double -> Double
 signum x
   | x > 0     = 1
   | x < 0     = negate 1
   | otherwise = x
 }}}

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


More information about the ghc-tickets mailing list