[ODE] 0.8.2 candidate
Oleh Derevenko
oder at eleks.lviv.ua
Tue Oct 2 01:29:13 MST 2007
Hi Jon
----- Original Message -----
From: "Jon Watte (ODE)"
To: "Oleh Derevenko"
>> Well, it IS normalized. But because of limited precision of floats the
>> modulo of vector is something around 0.996. In addition to using floats,
>> also the way the normalization is performed increases negative effect on
>> precision of result. To be more time efficient normalization is performed
>> as multiplication for length reciprocal instead of division. This adds
>> extra computational error.
>>
> The error in a float is not 0.4% of the value. The error in a float is in
> the sixth digit, at worst.
>
> Perhaps what you're saying is that, because the value into the
> normalization function is so large (far away from the origin), the
> normalize fails. That means that normalize isn't robust. Typically, you'll
> want to multiply by the reciprocal of the largest component BEFORE you
> take the square root to measure the length, if you know that your normal
> will be far off (e g, longer than 10.0 units).
Indeed, larger magnitude of vector components increases exponential
difference during component square calculation. That difference produces
larger computational errors during subsequent addition. However you also get
computational error when mantisa of length is truncated to fit into float,
then, when reciprocal is calculated from length which has already been
truncated and then, when vector components are truncated to float once again
at the end of normalization.
By introducing extra multiplication before length calculation you will
decrease error of addition operation but introduce more distortion to vector
direction because that multiplication will be a separate operation and its
result will be truncated to precision of float as well.
Oleh Derevenko
-- ICQ: 36361783
More information about the ODE
mailing list