Re: [Haskell-cafe] NaN as Integer value

2013-04-17 Thread wren ng thornton
On 4/14/13 8:53 PM, Kim-Ee Yeoh wrote: On Sun, Apr 14, 2013 at 3:28 PM, wren ng thornton w...@freegeek.org wrote: Whereas the problematic values due to infinities are overspecified, so no matter which answer you pick it's guaranteed to be the wrong answer half the time. Part of this whole

Re: [Haskell-cafe] NaN as Integer value

2013-04-17 Thread Levent Erkok
For better or worse; IEEE-754 settled many of these questions. I personally think the standard is a good compromise of what's practical, efficiently implementable, and mathematically sensible. I find the following paper by Rummer and Wahl an especially good read:

Re: [Haskell-cafe] NaN as Integer value

2013-04-15 Thread Gabriel Dos Reis
On Sun, Apr 14, 2013 at 7:53 PM, Kim-Ee Yeoh k...@atamo.com wrote: On Sun, Apr 14, 2013 at 3:28 PM, wren ng thornton w...@freegeek.org wrote: Whereas the problematic values due to infinities are overspecified, so no matter which answer you pick it's guaranteed to be the wrong answer half the

Re: [Haskell-cafe] NaN as Integer value

2013-04-14 Thread wren ng thornton
On 4/13/13 1:18 PM, Jerzy Karczmarczuk wrote: This is not a Haskell problem. For Ints, ALL representations are valid numbers, a NaN is a specific float object, unless I'm mistaken, so the introduction of such an abnormal number would require some serious modifications of the representation.

Re: [Haskell-cafe] NaN as Integer value

2013-04-14 Thread Kim-Ee Yeoh
On Sun, Apr 14, 2013 at 3:28 PM, wren ng thornton w...@freegeek.org wrote: Whereas the problematic values due to infinities are overspecified, so no matter which answer you pick it's guaranteed to be the wrong answer half the time. Part of this whole problem comes from the fact that floats

[Haskell-cafe] NaN as Integer value

2013-04-13 Thread Алексей Егоров
Hello haskellers, is there a reason why Integer doesn't have 'NaN' as value? I think it would be very convenient to be able to handle (1 `div` 0) as regular NaN value and not as exception. Thanks.___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] NaN as Integer value

2013-04-13 Thread Franco
Hello haskellers,is there a reason why Integer doesn't have 'NaN' as value?I think it would be very convenient to be able to handle (1 `div` 0) as regular NaN value and not as exception.Thanks. I think because, if you need NaN like values, `Maybe Int` does the same job without tainting the

Re: [Haskell-cafe] NaN as Integer value

2013-04-13 Thread Daniel Díaz Casanueva
You can always use the Maybe type as a follows: intDiv :: Integer - Integer - Maybe Integer intDiv _ 0 = Nothing intDiv n m = Just (div n m) This allows you to pattern match results of divisions: example :: Integer - Integer - Maybe Integer example n m = case intDiv 4 n of Nothing - Nothing

Re: [Haskell-cafe] NaN as Integer value

2013-04-13 Thread Jerzy Karczmarczuk
Franco answers a question : Hello haskellers,is there a reason why Integer doesn't have 'NaN' as value?I think it would be very convenient to be able to handle (1 `div` 0) as regular NaN value and not as exception.Thanks. I think because, if you need NaN like values, `Maybe Int` does the same