F.9 Mathematics <math.h>
- F.9.1 Trigonometric functions
- F.9.2 Hyperbolic functions
- F.9.3 Exponential and logarithmic functions
- F.9.3.1 The exp functions
- F.9.3.2 The exp2 functions
- F.9.3.3 The expm1 functions
- F.9.3.4 The frexp functions
- F.9.3.5 The ilogb functions
- F.9.3.6 The ldexp functions
- F.9.3.7 The log functions
- F.9.3.8 The log10 functions
- F.9.3.9 The log1p functions
- F.9.3.10 The log2 functions
- F.9.3.11 The logb functions
- F.9.3.12 The modf functions
- F.9.3.13 The scalbn and scalbln functions
- F.9.4 Power and absolute value functions
- F.9.5 Error and gamma functions
- F.9.6 Nearest integer functions
- F.9.7 Remainder functions
- F.9.8 Manipulation functions
- F.9.9 Maximum, minimum, and positive difference functions
- F.9.10 Floating multiply-add
This subclause contains specifications of <math.h> facilities that are particularly suited for IEC 60559 implementations.
The Standard C macro HUGE_VAL and its float and long double analogs, HUGE_VALF and HUGE_VALL, expand to expressions whose values are positive infinities.
Special cases for functions in <math.h> are covered directly or indirectly by IEC 60559. The functions that IEC 60559 specifies directly are identified in F.3. The other functions in <math.h> treat infinities, NaNs, signed zeros, subnormals, and (provided the state of the FENV_ACCESS pragma is “on”) the floating-point status flags in a manner consistent with the basic arithmetic operations covered by IEC 60559.
The expression math_errhandling & MATH_ERREXCEPT shall evaluate to a nonzero value.
The “invalid” and “divide-by-zero” floating-point exceptions are raised as specified in subsequent subclauses of this annex.
The “overflow” floating-point exception is raised whenever an infinity – or, because of rounding direction, a maximal-magnitude finite number – is returned in lieu of a value whose magnitude is too large.
The “underflow” floating-point exception is raised whenever a result is tiny (essentially subnormal or zero) and suffers loss of accuracy.[1]
Whether or when library functions raise the “inexact” floating-point exception is unspecified, unless explicitly specified otherwise.
Whether or when library functions raise an undeserved “underflow” floating-point exception is unspecified.[2] Otherwise, as implied by F.7.6, the <math.h> functions do not raise spurious floating-point exceptions (detectable by the user), other than the “inexact” floating-point exception.
Whether the functions honor the rounding direction mode is implementation-defined, unless explicitly specified otherwise.
Functions with a NaN argument return a NaN result and raise no floating-point exception, except where stated otherwise.
The specifications in the following subclauses append to the definitions in <math.h>. For families of functions, the specifications apply to all of the functions even though only the principal function is shown. Unless otherwise specified, where the symbol ‘’(+-)’’ occurs in both an argument and the result, the result has the same sign as the argument.
Recommended practice
If a function with one or more NaN arguments returns a NaN result, the result should be the same as one of the NaN arguments (after possible type conversion), except perhaps for the sign.
Footnotes