This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: SSE min/max take2-documentation


Re:

> We can use the identity (x > y ? x : y) == (-y <= -x ? y : x) 
> to uniformly handle all cases on all platforms. This identity
> holds in presence of signed zeroes, infinities and NaN's.
> 
>   -Geert

I don't think so:

popov-200% gcc -mieee -o test test.c -Wall -W
test.c:3: warning: division: NaN - producing operation
popov-201% ./test
1.000000
nan
popov-202% cat test.c
#include <stdio.h>

double x = 0.0/0.0;

double y = 1.0;

int main()
{
  printf("%f\n", (x > y ? x : y));
  printf("%f\n", (-y <= -x ? y : x));
  return 0;
}
popov-203% gcc -v
Reading specs from /export/u10/egcs-test/lib/gcc-lib/alphaev6-unknown-linux-gnu/3.0/specs
Configured with: ../configure --prefix=/export/u10/egcs-test --disable-checking --disable-shared
gcc version 3.0 20010224 (prerelease)

Brad


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]