Float Bug

Started by
13 comments, last by jonbell 20 years, 3 months ago
I have a strange bug, one of my vectors keeps getting its x,y,z set to -1.#INDO What is #INDO ?
Advertisement
indeterminate floatng point value.

google for a detailed description.

To the vast majority of mankind, nothing is more agreeable than to escape the need for mental exertion... To most people, nothing is more troublesome than the effort of thinking.
To the vast majority of mankind, nothing is more agreeable than to escape the need for mental exertion... To most people, nothing is more troublesome than the effort of thinking.
quote:Original post by jonbell
I have a strange bug, one of my vectors keeps getting its x,y,z set to -1.#INDO

What is #INDO ?


Probably your debugger (you are using debug version) is alerting you that you have not initialized the variables; the debug version usually fill memory/variable with deafult values.
It''s not a bug but it can be a problem if you use your vector without init.
The values are correct until some bug occurs and then they become -1.INDO

What can cause a valid floating point value to be set to this? Am i correct in thinking that it does not have a value of -1 rather its value is undefined?
quote:Original post by jonbell
The values are correct until some bug occurs and then they become -1.INDO

What can cause a valid floating point value to be set to this? Am i correct in thinking that it does not have a value of -1 rather its value is undefined?


See also division by zero!
No i don''t get a crash so its not div by 0. I am seeing the values in the debugger but it is very difficult to get a breakpoint when the values get screwed cause i can''t test for -1.#indo

Anyone know what this value means and what can cause it?
did you even consider my reply?

it stands for indeterminate float value. it can be caused by various operations (i.e. infinity * infinity, 0 * infinity, etc). it means the result cannot be determined.

ieeefloat

To the vast majority of mankind, nothing is more agreeable than to escape the need for mental exertion... To most people, nothing is more troublesome than the effort of thinking.
To the vast majority of mankind, nothing is more agreeable than to escape the need for mental exertion... To most people, nothing is more troublesome than the effort of thinking.
quote:Original post by jonbell
No i don''t get a crash so its not div by 0. I am seeing the values in the debugger but it is very difficult to get a breakpoint when the values get screwed cause i can''t test for -1.#indo

Anyone know what this value means and what can cause it?


Floating point divisions by zero do not crash (only integer divisions do), they yield either +infinity, -infinity or NaN (Not a Number), which is precisely what you got here : you made, somewhere, an operation that doesn''t make sense mathematically (for real numbers) such as 0/0, infinity/infinity, infinity-infinity, square root of a negative number, arc-cosine of a number not in [-1,1], etc.
"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
fruny: teach a man to fish....

To the vast majority of mankind, nothing is more agreeable than to escape the need for mental exertion... To most people, nothing is more troublesome than the effort of thinking.
To the vast majority of mankind, nothing is more agreeable than to escape the need for mental exertion... To most people, nothing is more troublesome than the effort of thinking.
Actually, floating point dbz''s raise an exception, but floating point exceptions are masked by default on MSVC and many other compilers. Borland products (notably Delphi and C-builder) don''t mask them and will break the program.

Kippesoep

This topic is closed to new replies.

Advertisement