[ODE] Length calculation

Jon Watte (ODE) hplus-ode at mindcontrol.org
Thu Oct 11 19:30:13 MST 2007



Oleh Derevenko wrote:
> Why? Multiplications and divisions do not introduce substantial error. At 
> the same time, length calculation, as seen from dNormalize3, is much more 
> precise after you divide by largest vector component.
>   

Do the analysis: it doesn't help. It may hurt. With the normal 
formulation, you do math on the basic quantities. With the "normalized" 
components, multiplied by the largest value, for very long vectors, 
you're getting small-by-large multiplication (not any more precise), and 
for very short vectors you're getting division-by-small-value (not any 
more precise).

The reason it's helpful for normalizing vectors is that you are trading 
direction precision for precision in hitting length 1.0 as exactly as 
possible when pre-dividing by the longest component. When calculating 
the length, you don't want to do that.

Btw: Repeated multiplication or division may introduce a last-bit error 
per operation.

Cheers,

          / h+




More information about the ODE mailing list