[Insight-developers] vnl test failing on SGI

Hans J. Johnson hans-johnson at uiowa.edu
Mon, 12 Jan 2004 10:10:26 -0600


Hello again,

Would someone please forward this to the VNL folks if that is the
appropriate space for it?

There has been a single vnl test failure on SGI platform for some time
now.  The error occurs when trying to determine if a "long double" has 
a "nan" value.   There is magic here that I don't understand.

141 vnl_math_isnan(long double x) {
142   if (sizeof(long double) == 8) return bMe(&x,0x7ff00000L,sz_l) &&
bMp(&x,0x000fffffL,sz_l);
143   else if (sizeof(long double) <= 12) return
bMe(&x,0x4001ffffL,sz_l) && bMp(&x,0x40000000,sz_l-4);
144/*This is returning the wrong value*/   else return
bMe(&x,0x7ff70000L,sz_l) && bMp(&x,0x0008ffffL,sz_l);
145  }

The debugger reports that x has
Value: nan0x000000010000000

But this function is returning false.  My guess is that a long double on
SGI is larger than that on all other platforms, and the the logic is
wrong for when there are more than 12 bytes in a long double.

Regards,
Hans