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 findout what input was going into the sqrt, as I suspected there was rubish 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.



Robert Lacroix 2012-07-20 02:40:25

The Google query didn’t get you results because the dash in front gives you pages that exclude the parameter, so your search included no keyword actually… Try without the dash ;)

Simeon 2012-07-20 07:12:50

Ah, so caught up in my own world, I forgot about how Google parses the search terms. Ah look at all the results. Thank you Robert.