maint: update copyright
[gnulib.git] / m4 / minus-zero.m4
1 # minus-zero.m4 serial 2
2 dnl Copyright (C) 2010-2014 Free Software Foundation, Inc.
3 dnl This file is free software; the Free Software Foundation
4 dnl gives unlimited permission to copy and/or distribute it,
5 dnl with or without modifications, as long as this notice is preserved.
6
7 # Macros for floating-point negative zero.
8 # Keep in sync with tests/minus-zero.h!
9
10 # Expands to code that defines a variable or macro minus_zerof.
11 AC_DEFUN([gl_FLOAT_MINUS_ZERO_CODE],
12 [[
13 #include <float.h>
14 /* minus_zerof represents the value -0.0f.  */
15 /* HP cc on HP-UX 10.20 has a bug with the constant expression -0.0f.
16    ICC 10.0 has a bug when optimizing the expression -zero.
17    The expression -FLT_MIN * FLT_MIN does not work when cross-compiling
18    to PowerPC on Mac OS X 10.5.  */
19 #if defined __hpux || defined __sgi || defined __ICC
20 static float
21 compute_minus_zerof (void)
22 {
23   return -FLT_MIN * FLT_MIN;
24 }
25 # define minus_zerof compute_minus_zerof ()
26 #else
27 float minus_zerof = -0.0f;
28 #endif
29 ]])
30
31 # Expands to code that defines a variable or macro minus_zerod.
32 AC_DEFUN([gl_DOUBLE_MINUS_ZERO_CODE],
33 [[
34 #include <float.h>
35 /* minus_zerod represents the value -0.0.  */
36 /* HP cc on HP-UX 10.20 has a bug with the constant expression -0.0.
37    ICC 10.0 has a bug when optimizing the expression -zero.
38    The expression -DBL_MIN * DBL_MIN does not work when cross-compiling
39    to PowerPC on Mac OS X 10.5.  */
40 #if defined __hpux || defined __sgi || defined __ICC
41 static double
42 compute_minus_zerod (void)
43 {
44   return -DBL_MIN * DBL_MIN;
45 }
46 # define minus_zerod compute_minus_zerod ()
47 #else
48 double minus_zerod = -0.0;
49 #endif
50 ]])
51
52 # Expands to code that defines a variable or macro minus_zerol.
53 AC_DEFUN([gl_LONG_DOUBLE_MINUS_ZERO_CODE],
54 [[
55 #include <float.h>
56 #if defined __i386__ && (defined __BEOS__ || defined __OpenBSD__)
57 # undef LDBL_MIN
58 # define LDBL_MIN        3.3621031431120935063E-4932L
59 #endif
60 /* minus_zerol represents the value -0.0L.  */
61 /* HP cc on HP-UX 10.20 has a bug with the constant expression -0.0L.
62    IRIX cc can't put -0.0L into .data, but can compute at runtime.
63    ICC 10.0 has a bug when optimizing the expression -zero.
64    The expression -LDBL_MIN * LDBL_MIN does not work when cross-compiling
65    to PowerPC on Mac OS X 10.5.  */
66 #if defined __hpux || defined __sgi || defined __ICC
67 static long double
68 compute_minus_zerol (void)
69 {
70   return -LDBL_MIN * LDBL_MIN;
71 }
72 # define minus_zerol compute_minus_zerol ()
73 #else
74 long double minus_zerol = -0.0L;
75 #endif
76 ]])