(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.c-torture/
execute/
ieee/
mzero3.c
       1  /* Copyright (C) 2002  Free Software Foundation.
       2     by Hans-Peter Nilsson  <hp@bitrange.com>, derived from mzero2.c
       3  
       4     In the MMIX port, negdf2 was bogusly expanding -x into 0 - x.  */
       5  
       6  double nzerod = -0.0;
       7  float nzerof = -0.0;
       8  double zerod = 0.0;
       9  float zerof = 0.0;
      10  
      11  void expectd (double, double);
      12  void expectf (float, float);
      13  double negd (double);
      14  float negf (float);
      15  
      16  main ()
      17  {
      18    expectd (negd (zerod), nzerod);
      19    expectf (negf (zerof), nzerof);
      20    expectd (negd (nzerod), zerod);
      21    expectf (negf (nzerof), zerof);
      22    exit (0);
      23  }
      24  
      25  void
      26  expectd (double value, double expected)
      27  {
      28    if (value != expected
      29        || memcmp ((void *)&value, (void *) &expected, sizeof (double)) != 0)
      30      abort ();
      31  }
      32  
      33  void
      34  expectf (float value, float expected)
      35  {
      36    if (value != expected
      37        || memcmp ((void *)&value, (void *) &expected, sizeof (float)) != 0)
      38      abort ();
      39  }
      40  
      41  double
      42  negd (double v)
      43  {
      44    return -v;
      45  }
      46  
      47  float
      48  negf (float v)
      49  {
      50    return -v;
      51  }