
#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: | -------------------------------------+------------------------------------- Changes (by rwbarton): * milestone: => 7.10.1 Comment: We can replace the expensive `isNegativeZero x` test in `abs` with `x == 0`, since `abs` of positive zero is also zero. {{{ abs x | x == 0 = 0 | x >= 0 = x | otherwise = negate x }}} Of course this merits a comment on the first guard! As for `signum`, I don't see off-hand a simple way to work around the bug #9238, so I suggest we apply the `abs` patch, then mark this ticket as blocked by #9238. If someone gets around to implementing efficient `abs` and `signum` with fancy bit tricks before 7.10 then it will become moot anyway. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/7858#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler