(root)/
gettext-0.22.4/
gettext-tools/
gnulib-tests/
minus-zero.h
       1  /* Macros for floating-point negative zero.
       2     Copyright (C) 2010-2023 Free Software Foundation, Inc.
       3  
       4     This program is free software: you can redistribute it and/or modify
       5     it under the terms of the GNU General Public License as published by
       6     the Free Software Foundation, either version 3 of the License, or
       7     (at your option) any later version.
       8  
       9     This program is distributed in the hope that it will be useful,
      10     but WITHOUT ANY WARRANTY; without even the implied warranty of
      11     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      12     GNU General Public License for more details.
      13  
      14     You should have received a copy of the GNU General Public License
      15     along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
      16  
      17  /* Keep in sync with m4/minus-zero.m4!  */
      18  
      19  #include <float.h>
      20  
      21  
      22  /* minus_zerof represents the value -0.0f.  */
      23  
      24  /* HP cc on HP-UX 10.20 has a bug with the constant expression -0.0f.
      25     ICC 10.0 has a bug when optimizing the expression -zero.
      26     The expression -FLT_MIN * FLT_MIN does not work when cross-compiling
      27     to PowerPC on Mac OS X 10.5.  */
      28  #if defined __hpux || defined __sgi || defined __ICC
      29  static float
      30  compute_minus_zerof (void)
      31  {
      32    return -FLT_MIN * FLT_MIN;
      33  }
      34  # define minus_zerof compute_minus_zerof ()
      35  #else
      36  float minus_zerof = -0.0f;
      37  #endif
      38  
      39  
      40  /* minus_zerod represents the value -0.0.  */
      41  
      42  /* HP cc on HP-UX 10.20 has a bug with the constant expression -0.0.
      43     ICC 10.0 has a bug when optimizing the expression -zero.
      44     The expression -DBL_MIN * DBL_MIN does not work when cross-compiling
      45     to PowerPC on Mac OS X 10.5.  */
      46  #if defined __hpux || defined __sgi || defined __ICC
      47  static double
      48  compute_minus_zerod (void)
      49  {
      50    return -DBL_MIN * DBL_MIN;
      51  }
      52  # define minus_zerod compute_minus_zerod ()
      53  #else
      54  double minus_zerod = -0.0;
      55  #endif
      56  
      57  
      58  /* minus_zerol represents the value -0.0L.  */
      59  
      60  /* HP cc on HP-UX 10.20 has a bug with the constant expression -0.0L.
      61     IRIX cc can't put -0.0L into .data, but can compute at runtime.
      62     ICC 10.0 has a bug when optimizing the expression -zero.
      63     The expression -LDBL_MIN * LDBL_MIN does not work when cross-compiling
      64     to PowerPC on Mac OS X 10.5.  */
      65  #if defined __hpux || defined __sgi || defined __ICC
      66  static long double
      67  compute_minus_zerol (void)
      68  {
      69    return -LDBL_MIN * LDBL_MIN;
      70  }
      71  # define minus_zerol compute_minus_zerol ()
      72  #else
      73  long double minus_zerol = -0.0L;
      74  #endif