This project is read-only.
1

Closed

vector3 normalize not always correct.

description

Sometimes the normalize function does not work properly.
I get this error when normalizing a Vector3(0.13243,0,0) (or something.)
I then get a normalized vector of Vector3(0.999999,0,0)...
 
Sander.
Closed Jan 26, 2011 at 10:29 PM by vetuomia

comments

vetuomia wrote Jan 26, 2011 at 10:24 PM

This is normal and expected behavior. The error is caused by the finite precision of the floating point numbers, producing a vector with length very close to 1.0 but not exactly. In practice, this rarely matters.

For more information, see [url:http://en.wikipedia.org/wiki/Floating_point#Accuracy_problems] and [url:http://floating-point-gui.de/basic/].

wrote Jan 26, 2011 at 10:29 PM

wrote Jan 26, 2011 at 10:29 PM

wrote Feb 14, 2013 at 9:27 PM

wrote May 16, 2013 at 11:19 AM