Fix test errors after r15-1394 for sizeof(int)==sizeof(long) [PR115545]
[official-gcc.git] / gcc / testsuite / gcc.c-torture / execute / ieee / unsafe-fp-assoc-1.c
blob7021b99ad7fde1f5852fb08732451726696d112c
1 extern void abort();
3 typedef union {
4 struct {
5 unsigned int hi;
6 unsigned int lo;
7 } i;
8 double d;
9 } hexdouble;
11 static const double twoTo52 = 0x1.0p+52;
13 void func ( double x )
15 hexdouble argument;
16 register double y, z;
17 unsigned int xHead;
18 argument.d = x;
19 xHead = argument.i.hi & 0x7fffffff;
20 if (__builtin_expect(!!(xHead < 0x43300000u), 1))
22 y = ( x - twoTo52 ) + twoTo52;
23 if ( y != x )
24 abort();
25 z = x - 0.5;
26 y = ( z - twoTo52 ) + twoTo52;
27 if ( y == (( x - twoTo52 ) + twoTo52) )
28 abort();
30 return;
33 int main()
35 if (sizeof (double) == 4)
36 return 0;
37 func((double)1.00);
38 return 0;