Advertisement

My floats Vars have the Value NAN

Started by November 09, 2002 05:53 AM
1 comment, last by glnefugio 22 years, 3 months ago
hi, My Vector class is like the one in OpenGL Game Programming Book. 3 Float Vars. IF all Vars (x,y,z) get all 0.0f the next compiler step all vars have the value nan! SO what can I do?? The vector is no pointer and the vars to! Do you have an idea!?
Then use very small, non zero values, instead of zero?
Advertisement
NaN (not a number) is the result of mathematically undefined operations such as 0/0, ∞-∞, ∞/∞

You are probably trying to normalise your vector - which ends up being a division of zero (coordinate) by zero (length) when all the coordinates are null.

Documents [ GDNet | MSDN | STL | OpenGL | Formats | RTFM | Asking Smart Questions ]
C++ Stuff [ MinGW | Loki | SDL | Boost. | STLport | FLTK | ACCU Recommended Books ]
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan

This topic is closed to new replies.

Advertisement