Andreas Schwab wrote:
> The problem is that the test is bogus.  The position of one of the
> exponent bits does not say anything about the position of the SNAN bit.
> For example, the Motorola double extended format has 16 bits of padding
> between the exponent and the mantissa.  Even with out padding there is
> no requirement that the SNAN bit is adjacent to the exponent.

The purpose of the test is not to create a signalling NaN (despite the
comment saying so). The purpose is to create a binary representation of
a NaN that is not one of the "usual" NaNs.

On ia64, the binary representation of the created number is

   { 0x00000000, 0x40000001, 0x0000ffff, 0x00000000 }

  printf ("X == X = %d\n", X == X);
  printf ("X + X == X = %d\n", X + X == X);
  printf ("X >= 0 || X <= 0 = %d\n", X >= 0 || X <= 0);

all print 0. So it must be a NaN.

Bruno



Reply via email to