[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Graphics Rounding (was Re: Pixel-aligned autoresizing)
From: |
Tim Schmielau |
Subject: |
Re: Graphics Rounding (was Re: Pixel-aligned autoresizing) |
Date: |
Tue, 12 Jul 2011 02:52:47 +0100 |
On 11 Jul 2011, at 08:23, Riccardo Mottola wrote:
> To my knowledge, rint() doesn't do any advanced rounding. It doesn't try to
> minimize the error by rounding odd numbers down and even up or something like
> that, it uses a standard round direction. 16.5 will become 17 as 17.5 will
> become 18. That is, the round error hasn't a zero expected value.
>
>
> To prove that, I executed a loop in 0.1 steps and printed out the results:
>
> long float: 16.000000, rounded: 16.000000
> long float: 16.100000, rounded: 16.000000
> long float: 16.200000, rounded: 16.000000
> long float: 16.300000, rounded: 16.000000
> long float: 16.400000, rounded: 16.000000
> long float: 16.500000, rounded: 17.000000
> long float: 16.600000, rounded: 17.000000
> long float: 16.700000, rounded: 17.000000
> long float: 16.800000, rounded: 17.000000
> long float: 16.900000, rounded: 17.000000
> long float: 17.000000, rounded: 17.000000
> long float: 17.100000, rounded: 17.000000
> long float: 17.200000, rounded: 17.000000
> long float: 17.300000, rounded: 17.000000
> long float: 17.400000, rounded: 17.000000
> long float: 17.500000, rounded: 18.000000
> long float: 17.600000, rounded: 18.000000
> long float: 17.700000, rounded: 18.000000
> long float: 17.800000, rounded: 18.000000
> long float: 17.900000, rounded: 18.000000
Note that with steps of 0.1 you will not see the round-to-nearest-even
behavior, as it will not trip on the exact halfway points due to rounding
errors. Increment by 0.25 to check whether round-to-nearest-even is in action.
Tim
- Re: Pixel-aligned autoresizing, (continued)
- Re: Pixel-aligned autoresizing, Eric Wasylishen, 2011/07/08
- Re: Pixel-aligned autoresizing, Fred Kiefer, 2011/07/08
- Re: Pixel-aligned autoresizing, Eric Wasylishen, 2011/07/08
- Re: Pixel-aligned autoresizing, Fred Kiefer, 2011/07/08
- Re: Pixel-aligned autoresizing, Philippe Roussel, 2011/07/09
- Graphics Rounding (was Re: Pixel-aligned autoresizing), Eric Wasylishen, 2011/07/09
- Re: Graphics Rounding (was Re: Pixel-aligned autoresizing), Fred Kiefer, 2011/07/10
- Re: Graphics Rounding (was Re: Pixel-aligned autoresizing), Eric Wasylishen, 2011/07/10
- Re: Graphics Rounding (was Re: Pixel-aligned autoresizing), Riccardo Mottola, 2011/07/11
- Re: Graphics Rounding (was Re: Pixel-aligned autoresizing), Eric Wasylishen, 2011/07/11
- Re: Graphics Rounding (was Re: Pixel-aligned autoresizing),
Tim Schmielau <=
- Re: Graphics Rounding (was Re: Pixel-aligned autoresizing), Riccardo Mottola, 2011/07/12
- Re: Graphics Rounding (was Re: Pixel-aligned autoresizing), Philippe Roussel, 2011/07/11
- Re: Graphics Rounding (was Re: Pixel-aligned autoresizing), Eric Wasylishen, 2011/07/12
- Re: Graphics Rounding (was Re: Pixel-aligned autoresizing), Philippe Roussel, 2011/07/13
- Re: Graphics Rounding (was Re: Pixel-aligned autoresizing), David Chisnall, 2011/07/20
- autoresizing in the case of negative flexible space (was Re: Pixel-aligned autoresizing), Tim Schmielau, 2011/07/22
- Re: autoresizing in the case of negative flexible space (was Re: Pixel-aligned autoresizing), Fred Kiefer, 2011/07/23
- Re: autoresizing in the case of negative flexible space (was Re: Pixel-aligned autoresizing), Tim Schmielau, 2011/07/23