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

Felipe Lessa felipe.lessa at gmail.com
Mon Oct 27 06:29:28 EDT 2008


(Janis, sorry for e-mailiing just for you on the first time.)

On Mon, Oct 27, 2008 at 8:15 AM, Janis Voigtlaender
<voigt at tcs.inf.tu-dresden.de> wrote:
> That is of course true (and was the topic of heated discussion with my
> fourth grade math teacher), but does not explain 2.5 -> 2.

If you round to odd instead of round to even, then 4.5 rounds to 5,
which would may need rounding again and introduce double rounding
errors. For a simple example,

2.45 -> 2.4 -> 2
2.45 -> 2.5 -> 3

The Wikipedia article that was linked in this thread talks about this
problem as well.

-- 
Felipe.


More information about the Haskell-Cafe mailing list