F.9 Mathematics <math.h>

1

This subclause contains specifications of <math.h> facilities that are particularly suited for IEC 60559 implementations.

2

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.

3

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.

4

The expression math_errhandling & MATH_ERREXCEPT shall evaluate to a nonzero value.

5

The “invalid” and “divide-by-zero” floating-point exceptions are raised as specified in subsequent subclauses of this annex.

6

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.

7

The “underflow” floating-point exception is raised whenever a result is tiny (essentially subnormal or zero) and suffers loss of accuracy.[1]

8

Whether or when library functions raise the “inexact” floating-point exception is unspecified, unless explicitly specified otherwise.

9

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.

10

Whether the functions honor the rounding direction mode is implementation-defined, unless explicitly specified otherwise.

11

Functions with a NaN argument return a NaN result and raise no floating-point exception, except where stated otherwise.

12

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

13

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