[cfenv] (original) (raw)

29 Numerics library [numerics]

29.3 The floating-point environment [cfenv]

29.3.1 Header synopsis [cfenv.syn]

The contents and meaning of the header are the same as the C standard library header .

[Note 1:

This document does not require an implementation to support theFENV_ACCESS pragma; it is implementation-defined ([cpp.pragma]) whether the pragma is supported.

As a consequence, it is implementation-defined whether these functions can be used to test floating-point status flags, set floating-point control modes, or run under non-default mode settings.

If the pragma is used to enable control over the floating-point environment, this document does not specify the effect on floating-point evaluation in constant expressions.

— _end note_]

See also: ISO/IEC 9899:2018, 7.6

29.3.2 Threads [cfenv.thread]

The initial state for a thread's floating-point environment is the state of the floating-point environment of the thread that constructs the corresponding thread object ([thread.thread.class]) or jthread object ([thread.jthread.class]) at the time it constructed the object.

[Note 1:

That is, the child thread gets the floating-point state of the parent thread at the time of the child's creation.

— _end note_]

A separate floating-point environment is maintained for each thread.

Each function accesses the environment corresponding to its calling thread.