[racket] Rounding

From: Danny Yoo (dyoo at hashcollision.org)
Date: Sat Mar 16 20:33:16 EDT 2013

>
> Since when is round 0.5 not giving 1?!

According to the documentation:

    http://docs.racket-lang.org/reference/generic-numbers.html#%28def._%28%28quote._~23~25kernel%29._round%29%29

    "Returns the integer closest to x, resolving ties in favor of an
even number... "

And zero is an even number.  (http://www.bbc.co.uk/news/magazine-20559052)

So although it may be surprising, at least the behavior is documented.



Mathworld and Wikipedia say that this is done to combat statistical biasing:

    http://mathworld.wolfram.com/NearestIntegerFunction.html
    http://en.wikipedia.org/wiki/Rounding#Round_half_to_even

Posted on the users mailing list.