1math.h(3HEAD) Headers math.h(3HEAD)
2
3
4
6 math.h, math - mathematical declarations
7
9 #include <math.h>
10
11
13 The <math.h> header includes definitions for the following types:
14
15 float_t A real-floating type at least as wide as float.
16
17
18 double_t A real-floating type at least as wide as double, and at
19 least as wide as float_t.
20
21
22
23 If FLT_EVAL_METHOD equals 0, float_t and double_t are float and double,
24 respectively. If FLT_EVAL_METHOD equals 1, they are both double. If
25 FLT_EVAL_METHOD equals 2, they are both be long double. Other values of
26 FLT_EVAL_METHOD are implementation-defined.
27
28
29 The <math.h> header provides the following constants. The values are of
30 type double and are accurate within the precision of the double type.
31
32 M_E The base of natural logarithms (e).
33
34
35 M_LOG2E The base-2 logarithm of e.
36
37
38 M_LOG10E The base-10 logarithm of e.
39
40
41 M_LN2 The natural logarithm of 2.
42
43
44 M_LN10 The natural logarithm of 10.
45
46
47 M_PI pi, the ratio of the circumference of a circle to its
48 diameter.
49
50
51 M_PI_2 pi/2.
52
53
54 M_PI_4 pi/4.
55
56
57 M_1_PI 1/pi
58
59
60 M_2_PI 2/pi
61
62
63 M_2_SQRTPI 2 over the square root of pi
64
65
66 M_SQRT2 The positive square root of 2.
67
68
69 M_SQRT1_2 The positive square root of 1/2.
70
71
72
73 The <math.h> header defines the following symbolic constants:
74
75 MAXFLOAT The maximum value of a non-infinite single-precision
76 floating point number.
77
78
79 HUGE_VAL A positive double expression, not necessarily repre‐
80 sentable as a float. Used as an error value returned by
81 the mathematics library. HUGE_VAL evaluates to +infinity
82 on systems supporting IEEE Std 754-1985.
83
84
85 HUGE_VALF A positive float constant expression. Used as an error
86 value returned by the mathematics library. HUGE_VALF eval‐
87 uates to +infinity on systems supporting IEEE Std
88 754-1985.
89
90
91 HUGE_VALL A positive long double constant expression. Used as an
92 error value returned by the mathematics library. HUGE_VALL
93 evaluates to +infinity on systems supporting IEEE Std
94 754-1985.
95
96
97 INFINITY A constant expression of type float representing positive
98 or unsigned infinity, if available; else a positive con‐
99 stant of type float that overflows at translation time.
100
101
102 NAN A constant expression of type float representing a quiet
103 NaN. This symbolic constant is only defined if the imple‐
104 mentation supports quiet NaNs for the float type.
105
106
107
108 The following macros are defined for number classification. They repre‐
109 sent the mutually-exclusive kinds of floating-point values. They expand
110 to integer constant expressions with distinct values
111
112 FP_INFINITE
113 FP_NAN
114 FP_NORMAL
115 FP_SUBNORMAL
116 FP_ZERO
117
118
119
120 The following optional macros indicate whether the fma() family of
121 functions are fast compared with direct code:
122
123 FP_FAST_FMA
124 FP_FAST_FMAF
125 FP_FAST_FMAL
126
127
128
129 The FP_FAST_FMA macro is defined to indicate that the fma() function
130 generally executes about as fast as, or faster than, a multiply and an
131 add of double operands. The other macros have the equivalent meaning
132 for the float and long double versions.
133
134
135 The following macros expand to integer constant expressions whose val‐
136 ues are returned by ilogb(x) if x is zero or NaN, respectively. The
137 value of FP_ILOGB0 is either {INT_MIN} or -{INT_MAX}. The value of
138 FP_ILOGBNAN is either {INT_MAX} or {INT_MIN}.
139
140 FP_ILOGB0
141 FP_ILOGBNAN
142
143
144
145 The following macros expand to the integer constants 1 and 2, respec‐
146 tively:
147
148 MATH_ERRNO
149 MATH_ERREXCEPT
150
151
152
153 The following macro expands to an expression that has type int and the
154 value MATH_ERREXCEPT:
155
156 math_errhandling
157
158
159
160 The value of the macro math_errhandling is constant for the duration of
161 the program. If a macro definition is suppressed or a program defines
162 an identifier with the name math_errhandling, the behavior is unde‐
163 fined.
164
165
166 The <math.h> header defines he following external variable:
167
168 extern int signgam;
169
170
171
172 The <math.h> header defines the structure and constants used by the
173 matherr(3M) error-handling mechanisms.
174
176 See attributes(5) for descriptions of the following attributes:
177
178
179
180
181 ┌─────────────────────────────┬─────────────────────────────┐
182 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
183 ├─────────────────────────────┼─────────────────────────────┤
184 │Interface Stability │Standard │
185 └─────────────────────────────┴─────────────────────────────┘
186
188 Intro(3), fenv.h(3HEAD), libm(3LIB), limits.h(3HEAD), matherr(3M),
189 attributes(5), standards(5)
190
191
192
193SunOS 5.11 11 Aug 2004 math.h(3HEAD)