
21 Apr
2013
21 Apr
'13
7:10 p.m.
On Thursday 11 April 2013, 08:07:57, Levent Erkok wrote:
On Thu, Apr 11, 2013 at 2:58 AM, Shachaf Ben-Kiki
wrote: Maybe it would be simpler to say:
signum x | x == 0 = x
| isNaN x = x | x > 0 = 1 | otherwise = negate 1
Shachaf
Thanks Shachaf. This version is equivalent to the one I proposed, and it saves one test; so it's definitely preferable. I'll put this one in the ticket that'll finally be created for GHC.
Also abs x | x < 0 = negate x | otherwise = x keeps the number of tests at one. Cheers, Daniel