[Insight-developers] vnl updates : Rounding Test : Performance and Correctness

Tom Vercauteren tom.vercauteren at m4x.org
Wed Dec 31 04:53:01 EST 2008


Hey Luis,

> BTW,
> If somebody can also explain why the rounding
> errors appear only in:
>
>                  -8.5  and -6.5
>
> and not in all even numbers in the range -10:10
>
>   -8.5, -6.5, -4.5, -2.5, 0.5, 2.5, 4.5, 6.5, 8.5
>
>
> that will be very kind as well...   :-)

In you test case you are not actually testing how half-integers are
rounded. As far as I can tell, since you start from -10 and increment
it by very small floating points, there is no reason for your test to
fall exactly on half integers. You may very well get for example
-2.5000000000000000000000000001 instead of -2.5. Therefore as you are
not rounding  -8.5, -6.5, -4.5, -2.5, 0.5, 2.5, 4.5, 6.5, 8.5 , they
cannot fail :)

Tom


More information about the Insight-developers mailing list