[Haskell-cafe] Why 'round' does not just round numbers ?
lemming at henning-thielemann.de
Mon Oct 27 07:23:00 EDT 2008
On Mon, 27 Oct 2008, Daniel Fischer wrote:
> Am Montag, 27. Oktober 2008 11:46 schrieb Henning Thielemann:
>> On Mon, 27 Oct 2008, Janis Voigtlaender wrote:
>>> Henning Thielemann wrote:
>>>> I think one reason is that repeated rounding should not be worse than
>>>> rounding in one go. Consider the rule 'use ceiling when the first
>>>> removed digit is 5'. Then
>>>> 0.45 - (round to one place) -> 0.5 - (round to integer) -> 1
>>> But repeated rounding *is* worse than rounding in one go, under any
>>> reasonable scheme:
>>> 3.46 -> 3.5 -> 4
>> With the rounding-to-even route this would be
>> 3.46 -> 3.4 -> 3
> Wait, that cannot be. 6 > 5, so 3.46 -> 3.5 even with banker's rounding.
You are right, my oversight. So only the method helps, that the last digit
is marked, whether it was generated by rounding up or down.
More information about the Haskell-Cafe