xref: /illumos-gate/usr/src/man/man3head/math.h.3head (revision ceb17889)

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
http://www.opengroup.org/bookstore/.

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 SunOS 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.

This notice shall appear on any product containing this material.

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.

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.

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]


Copyright 1989 AT&T.
Copyright (c) 2004, Sun Microsystems, Inc. All Rights Reserved.

MATH.H 3HEAD "May 19, 2022"
NAME
math.h, math - mathematical declarations
SYNOPSIS
#include <math.h>
DESCRIPTION
The <math.h> header includes definitions for the following types: float_t

A real-floating type at least as wide as float.

double_t

A real-floating type at least as wide as double, and at least as wide as float_t.

If FLT_EVAL_METHOD equals 0, float_t and double_t are float and double, respectively. If FLT_EVAL_METHOD equals 1, they are both double. If FLT_EVAL_METHOD equals 2, they are both be long double. Other values of FLT_EVAL_METHOD are implementation-defined.

The <math.h> header provides the following constants. The values are of type double and are accurate within the precision of the double type. M_E

The base of natural logarithms (e).

M_LOG2E

The base-2 logarithm of e.

M_LOG10E

The base-10 logarithm of e.

M_LN2

The natural logarithm of 2.

M_LN10

The natural logarithm of 10.

M_PI

\c \c , the ratio of the circumference of a circle to its diameter.

M_PI_2

\c \c /2.

M_PI_4

\c \c /4.

M_1_PI

1/\c \c .

M_2_PI

2/\c \c .

M_2_SQRTPI

2 over the square root of \c \c .

M_SQRT2

The positive square root of 2.

M_SQRT1_2

The positive square root of 1/2.

The <math.h> header defines the following symbolic constants: MAXFLOAT

The maximum value of a non-infinite single-precision floating point number.

HUGE_VAL

A positive double expression, not necessarily representable as a float. Used as an error value returned by the mathematics library. HUGE_VAL evaluates to +infinity on systems supporting IEEE Std 754-1985.

HUGE_VALF

A positive float constant expression. Used as an error value returned by the mathematics library. HUGE_VALF evaluates to +infinity on systems supporting IEEE Std 754-1985.

HUGE_VALL

A positive long double constant expression. Used as an error value returned by the mathematics library. HUGE_VALL evaluates to +infinity on systems supporting IEEE Std 754-1985.

INFINITY

A constant expression of type float representing positive or unsigned infinity, if available; else a positive constant of type float that overflows at translation time.

NAN

A constant expression of type float representing a quiet NaN. This symbolic constant is only defined if the implementation supports quiet NaNs for the float type.

The following macros are defined for number classification. They represent the mutually-exclusive kinds of floating-point values. They expand to integer constant expressions with distinct values

FP_INFINITE
FP_NAN
FP_NORMAL
FP_SUBNORMAL
FP_ZERO

The following optional macros indicate whether the fma() family of functions are fast compared with direct code:

FP_FAST_FMA
FP_FAST_FMAF
FP_FAST_FMAL

The FP_FAST_FMA macro is defined to indicate that the fma() function generally executes about as fast as, or faster than, a multiply and an add of double operands. The other macros have the equivalent meaning for the float and long double versions.

The following macros expand to integer constant expressions whose values are returned by ilogb(x) if x is zero or NaN, respectively. The value of FP_ILOGB0 is either {INT_MIN} or -{INT_MAX}. The value of FP_ILOGBNAN is either {INT_MAX} or {INT_MIN}.

FP_ILOGB0
FP_ILOGBNAN

The following macros expand to the integer constants 1 and 2, respectively:

MATH_ERRNO
MATH_ERREXCEPT

The following macro expands to an expression that has type int and the value MATH_ERREXCEPT:

math_errhandling

The value of the macro math_errhandling is constant for the duration of the program. If a macro definition is suppressed or a program defines an identifier with the name math_errhandling, the behavior is undefined.

The <math.h> header defines the following external variable:

extern int signgam;

The <math.h> header defines the structure and constants used by the matherr(3M) error-handling mechanisms.

ATTRIBUTES
See attributes(7) for descriptions of the following attributes:
ATTRIBUTE TYPE ATTRIBUTE VALUE
Interface Stability Standard
SEE ALSO
Intro (3), fenv.h (3HEAD), limits.h (3HEAD), libm (3LIB), matherr (3M), attributes (7), standards (7)