Merge commit 'dc97a43d4a70c8773a619f11b95b07a787f6f5b7' into merges
[unleashed.git] / share / man / man3head / math.h.3head
blob5eaee0ee2557ff9c53d770c994130003a59e6a6b
1 '\" te
2 .\" Copyright 1989 AT&T.  Copyright (c) 2004, Sun Microsystems, Inc.  All Rights Reserved.
3 .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for permission to reproduce portions of its copyrighted documentation. Original documentation from The Open Group can be obtained online at
4 .\" http://www.opengroup.org/bookstore/.
5 .\" The Institute of Electrical and Electronics Engineers and The Open Group, have given us permission to reprint portions of their documentation. In the following statement, the phrase "this text" refers to portions of the system documentation. Portions of this text are reprinted and reproduced in electronic form in the Sun OS Reference Manual, from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between these versions and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html.
6 .\"  This notice shall appear on any product containing this material.
7 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
8 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
9 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
10 .TH MATH.H 3HEAD "Aug 11, 2004"
11 .SH NAME
12 math.h, math \- mathematical declarations
13 .SH SYNOPSIS
14 .LP
15 .nf
16 \fB#include <math.h>\fR
17 .fi
19 .SH DESCRIPTION
20 .sp
21 .LP
22 The <\fBmath.h\fR> header includes definitions for the following types:
23 .sp
24 .ne 2
25 .na
26 \fB\fBfloat_t\fR\fR
27 .ad
28 .RS 12n
29 A real-floating type at least as wide as \fBfloat\fR.
30 .RE
32 .sp
33 .ne 2
34 .na
35 \fB\fBdouble_t\fR\fR
36 .ad
37 .RS 12n
38 A real-floating type at least as wide as \fBdouble\fR, and at least as wide as
39 \fBfloat_t\fR.
40 .RE
42 .sp
43 .LP
44 If \fBFLT_EVAL_METHOD\fR equals 0, \fBfloat_t\fR and \fBdouble_t\fR are
45 \fBfloat\fR and \fBdouble\fR, respectively. If \fBFLT_EVAL_METHOD\fR equals 1,
46 they are both \fBdouble\fR. If \fBFLT_EVAL_METHOD\fR equals 2, they are both be
47 \fBlong double\fR. Other values of \fBFLT_EVAL_METHOD\fR are
48 implementation-defined.
49 .sp
50 .LP
51 The <\fBmath.h\fR> header provides the following constants. The values are of
52 type \fBdouble\fR and are accurate within the precision of the \fBdouble\fR
53 type.
54 .sp
55 .ne 2
56 .na
57 \fB\fBM_E\fR\fR
58 .ad
59 .RS 14n
60 The base of natural logarithms (\fIe\fR).
61 .RE
63 .sp
64 .ne 2
65 .na
66 \fB\fBM_LOG2E\fR\fR
67 .ad
68 .RS 14n
69 The base-2 logarithm of \fIe\fR.
70 .RE
72 .sp
73 .ne 2
74 .na
75 \fB\fBM_LOG10E\fR\fR
76 .ad
77 .RS 14n
78 The base-10 logarithm of \fIe\fR.
79 .RE
81 .sp
82 .ne 2
83 .na
84 \fB\fBM_LN2\fR\fR
85 .ad
86 .RS 14n
87 The natural logarithm of 2.
88 .RE
90 .sp
91 .ne 2
92 .na
93 \fB\fBM_LN10\fR\fR
94 .ad
95 .RS 14n
96 The natural logarithm of 10.
97 .RE
99 .sp
100 .ne 2
102 \fB\fBM_PI\fR\fR
104 .RS 14n
106 .if n pi\c
107 .if t \(*p
109 , the ratio of the circumference of a circle to its diameter.
113 .ne 2
115 \fB\fBM_PI_2\fR\fR
117 .RS 14n
119 .if n pi\c
120 .if t \(*p
126 .ne 2
128 \fB\fBM_PI_4\fR\fR
130 .RS 14n
132 .if n pi\c
133 .if t \(*p
139 .ne 2
141 \fB\fBM_1_PI\fR\fR
143 .RS 14n
144 1/\c
145 .if n pi\c
146 .if t \(*p
152 .ne 2
154 \fB\fBM_2_PI\fR\fR
156 .RS 14n
157 2/\c
158 .if n pi\c
159 .if t \(*p
165 .ne 2
167 \fB\fBM_2_SQRTPI\fR\fR
169 .RS 14n
170 2 over the square root of \c
171 .if n pi\c
172 .if t \(*p
178 .ne 2
180 \fB\fBM_SQRT2\fR\fR
182 .RS 14n
183 The positive square root of 2.
187 .ne 2
189 \fB\fBM_SQRT1_2\fR\fR
191 .RS 14n
192 The positive square root of 1/2.
197 The <\fBmath.h\fR> header defines the following symbolic constants:
199 .ne 2
201 \fB\fBMAXFLOAT\fR\fR
203 .RS 13n
204 The maximum value of a non-infinite single-precision floating point number.
208 .ne 2
210 \fB\fBHUGE_VAL\fR\fR
212 .RS 13n
213 A positive \fBdouble\fR expression, not necessarily representable as a float.
214 Used as an error value returned by the mathematics library. \fBHUGE_VAL\fR
215 evaluates to +infinity on systems supporting IEEE Std 754-1985.
219 .ne 2
221 \fB\fBHUGE_VALF\fR\fR
223 .RS 13n
224 A positive \fBfloat\fR constant expression. Used as an error value returned by
225 the mathematics library. \fBHUGE_VALF\fR evaluates to +infinity on systems
226 supporting IEEE Std 754-1985.
230 .ne 2
232 \fB\fBHUGE_VALL\fR\fR
234 .RS 13n
235 A positive \fBlong double\fR constant expression. Used as an error value
236 returned by the mathematics library. \fBHUGE_VALL\fR evaluates to +infinity on
237 systems supporting IEEE Std 754-1985.
241 .ne 2
243 \fB\fBINFINITY\fR\fR
245 .RS 13n
246 A constant expression of type \fBfloat\fR representing positive or unsigned
247 infinity, if available; else a positive constant of type \fBfloat\fR that
248 overflows at translation time.
252 .ne 2
254 \fB\fBNAN\fR\fR
256 .RS 13n
257 A constant expression of type float representing a quiet NaN. This symbolic
258 constant is only defined if the implementation supports quiet NaNs for the
259 \fBfloat\fR type.
264 The following macros are defined for number classification. They represent the
265 mutually-exclusive kinds of floating-point values. They expand to integer
266 constant expressions with distinct values
268 .in +2
270 FP_INFINITE
271 FP_NAN
272 FP_NORMAL
273 FP_SUBNORMAL
274 FP_ZERO
276 .in -2
280 The following optional macros indicate whether the \fBfma()\fR family of
281 functions are fast compared with direct code:
283 .in +2
285 FP_FAST_FMA
286 FP_FAST_FMAF
287 FP_FAST_FMAL
289 .in -2
293 The \fBFP_FAST_FMA\fR macro is defined to indicate that the \fBfma()\fR
294 function generally executes about as fast as, or faster than, a multiply and an
295 add of \fBdouble\fR operands. The other macros have the equivalent meaning for
296 the \fBfloat\fR and \fBlong double\fR versions.
299 The following macros expand to integer constant expressions whose values are
300 returned by \fBilogb\fR(\fIx\fR) if \fIx\fR is zero or NaN, respectively. The
301 value of \fBFP_ILOGB0\fR is either {\fBINT_MIN\fR} or -{\fBINT_MAX\fR}. The
302 value of \fBFP_ILOGBNAN\fR is either {\fBINT_MAX\fR} or {\fBINT_MIN\fR}.
304 .in +2
306 FP_ILOGB0
307 FP_ILOGBNAN
309 .in -2
313 The following macros expand to the integer constants 1 and 2, respectively:
315 .in +2
317 MATH_ERRNO
318 MATH_ERREXCEPT
320 .in -2
324 The following macro expands to an expression that has type \fBint\fR and the
325 value \fBMATH_ERREXCEPT\fR:
327 .in +2
329 math_errhandling
331 .in -2
335 The value of the macro \fBmath_errhandling\fR is constant for the duration of
336 the program. If a macro definition is suppressed or a program defines an
337 identifier with the name \fBmath_errhandling\fR, the behavior is undefined.
340 The <\fBmath.h\fR> header defines he following external variable:
342 .in +2
344 extern int signgam;
346 .in -2
350 The <\fBmath.h\fR> header defines the structure and constants used by the
351 \fBmatherr\fR(3M) error-handling mechanisms.
352 .SH ATTRIBUTES
355 See \fBattributes\fR(5) for descriptions of the following attributes:
360 box;
361 c | c
362 l | l .
363 ATTRIBUTE TYPE  ATTRIBUTE VALUE
365 Interface Stability     Standard
368 .SH SEE ALSO
371 \fBIntro\fR(3), \fBfenv.h\fR(3HEAD), \fBlibm\fR(3LIB), \fBlimits.h\fR(3HEAD),
372 \fBmatherr\fR(3M), \fBattributes\fR(5), \fBstandards\fR(5)