[Haskell-cafe] Why 'round' does not just round numbers ?

John A. De Goes john at n-brain.net
Mon Oct 27 11:49:31 EDT 2008


It's well known from numerical analysis that you can achieve the best  
general behavior by rounding to even in "half" the cases, and rounding  
to odd in "half" the cases. It's usually deterministic by looking at  
the digit to the right of the round point.

Regards,

John A. De Goes
N-BRAIN, Inc.
http://www.n-brain.net
[n minds are better than n-1]

On Oct 27, 2008, at 10:59 AM, Jules Bean wrote:

>> This behaviour is not what I expect after reading the description at
>> http://haskell.org/ghc/docs/latest/html/libraries/base/ 
>> Prelude.html#v:round
>> .  Given that this behaviour has caused a bit of confusion I think a
>> change to the documention might be in order.
>
> The authority here is the report which says
>
> "round x returns the nearest integer to x, the even integer if x is  
> equidistant between two integers."
>
> However I agree the haddock ought to mirror the report.
>
> Jules
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe



More information about the Haskell-Cafe mailing list