[Insight-developers] vnl updates

Steve M. Robbins steve at sumost.ca
Tue Dec 30 16:32:25 EST 2008


On Tue, Dec 30, 2008 at 01:58:28PM -0500, Luis Ibanez wrote:

> Choosing the rounding standard based on the performance of the platform
> doesn't seem to be a good solution for ITK.
>
> We would want a round() function that produces the *same* output on
> *every* platform.

That makes sense to me.


> If we pick a rounding policy, it should be the same for all
> platforms, and it should also include a specification on how
> it will apply to negative numbers.

I've always been under the impression that round-to-even is to be
preferred, since the other methods (round-up, round-down, or
round-to-zero) will bias the calculations.

Quoting Wikipedia:

    Despite the custom of rounding the number 4.5 up to 5, in fact 4.5
    is no nearer to 5 than it is to 4 (it is 0.5 away from both). When
    dealing with large sets of scientific or statistical data, where
    trends are important, traditional rounding on average biases the
    data upwards slightly. Over a large set of data, or when many
    subsequent rounding operations are performed as in digital signal
    processing, the round-to-even rule tends to reduce the total
    rounding error, with (on average) an equal portion of numbers
    rounding up as rounding down. This generally reduces upwards
    skewing of the result.

    http://en.wikipedia.org/wiki/Rounding

Also, according to Goldberg's classic paper [1] Knuth also prefers
round-to-even, which is a strong recommendation in my books ;-)

[1] http://docs.sun.com/source/806-3568/ncg_goldberg.html

Cheers,
-Steve
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://www.itk.org/mailman/private/insight-developers/attachments/20081230/c7eb141a/attachment.pgp>


More information about the Insight-developers mailing list