modernc.org/ccgo/v3@v3.16.14/lib/testdata/gcc-9.1.0/gcc/testsuite/gcc.c-torture/execute/ieee/unsafe-fp-assoc-1.c (about)

     1  extern void abort();
     2  
     3  typedef union {
     4         struct {
     5    unsigned int hi;
     6    unsigned int lo;
     7   } i;
     8         double d;
     9  } hexdouble;
    10  
    11  static const double twoTo52 = 0x1.0p+52;
    12  
    13  void func ( double x )
    14  {
    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))
    21         {
    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();
    29         }
    30       return;
    31  }
    32  
    33  int main()
    34  {
    35  	if (sizeof (double) == 4)
    36  		return 0;
    37  	func((double)1.00);
    38  	return 0;
    39  }