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

     1  
     2  const double dnan = 1.0/0.0 - 1.0/0.0;
     3  double x = 1.0;
     4  
     5  extern void link_error (void);
     6  extern void abort (void);
     7  
     8  main ()
     9  {
    10  #if ! defined (__vax__) && ! defined (_CRAY)
    11    /* NaN is an IEEE unordered operand.  All these test should be false.  */
    12    if (dnan == dnan)
    13      link_error ();
    14    if (dnan != x)
    15      x = 1.0;
    16    else
    17      link_error ();
    18  
    19    if (dnan < x)
    20      link_error ();
    21    if (dnan > x)
    22      link_error ();
    23    if (dnan <= x)
    24      link_error ();
    25    if (dnan >= x)
    26      link_error ();
    27    if (dnan == x)
    28      link_error ();
    29  #endif
    30    exit (0);
    31  }
    32  
    33  #ifndef __OPTIMIZE__
    34  void link_error (void)
    35  {
    36    abort ();
    37  }
    38  #endif
    39