Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

-1.#IND000000000

Status
Not open for further replies.

ASingerMustDie

Programmer
Feb 1, 2001
17
GB
Hi All,

I have written a program for which I wrote an object to mimic dynamic 2D arrays, using a single imension array, and it has been working fine.

However, in a newer part of the program, when the method GetXY is called (to get the value at a certain coordinate), a value of -1.#IND000000000 is being returned, i.e:

currentValue = my2DArray.GetXY(xCo, yCo);
// currentValue is now -1.#IND000000000

Does anybody have any idea why this may be happening? I have traced through the GetXY function in the debugger and it works fine, it runs to the return line (return array[arrayValue]) and should be returning the correct value (array[arrayValue] is the expected value)...what is happening?

Any help would be greatly appreciated :)

double Array2D::GetXY(int xCo, int yCo)
{

// Calculate one-dimension equivalent of given values

int arrayValue = (yCo * xDim) + xCo;

// Ensure the value is within the array size and return
// corresponding value, or return NULL

if (arrayValue >= 0 && arrayValue < (xDim * yDim))
{

// The debugger traces to here with array[arrayValue]
// being the expected value

return array[arrayValue];
}
else
{
return NULL;
}
}
 
Hi

Is array[] of type double. If not then try casting your result. For example:

return (double)array[arrayValue];

Ive had similar problems with floats and ints which casting fixed.
 
It is indeed of type double...but I have found the problem goes away if I don't trace any associated functions/methods when debugging (which is annoying)...now I have a bother elsewhere with -1.#INFO
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top