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

Felipe Lessa felipe.lessa at gmail.com
Mon Oct 27 06:35:08 EDT 2008


On Mon, Oct 27, 2008 at 8:30 AM, Janis Voigtlaender
<voigt at tcs.inf.tu-dresden.de> wrote:
> Well, of course I did not learn to round to odd. I learned to round .5
> to above, but not to do repeated rounding.

Nobody rounds in passes, of course =). I was talking about two
successive rounds.

> In fact, by your explanation, you would have:
>
> 3.46 -> 3.5 -> 4
>
> Which is most odd. 3.46 is definitely closer to 3 than to 4.

If you're doing a double rounding, then this error will always happen.
Round to even avoids this error when the last digit was a 5, which is
good.

-- 
Felipe.


More information about the Haskell-Cafe mailing list