Debugging a recent issue, where our _matherr handler was logging a call to sqrt with -1.#IND00 as input, and in this same scenario the system was crashing (the actual problem needing to be solved).
So to find out what input was going into the sqrt, as I suspected there was rubbish being passed in, I wanted to know what -1.#IND00
was in binnary.
I knew that passing -1.0
to sqrt would result in -1.#IND00
in the result, so I altered the code:
int main ()
{
double d = sqrt(-1.0);
}
int __cdecl _matherr(struct _exception *e)
{
informf( "\\nMath Error: %s, Parameters: %lf %lf, Return: %lf\\n",
e->name, e->arg1, e->arg2, e->retval);
union ccc
{
double d;
struct {
long a;
long b;
} ll;
};
ccc aa;
aa.d = e->retval;
<break point here, and inspect aa in debugger>
if( _isnan( e->retval ) ) {
e->retval = 0;
}
return 1;
}
results in the values:
aa.ll.a = 0;
aa.ll.b = 0xFFF80000;
And I posted this because Googling for -1.#IND00 got me no results.