# Floating-point environment

< cpp‎ | numeric

C++
 Language Standard library headers Concepts Utilities library Strings library Containers library Algorithms library Iterators library Numerics library Input/output library Localizations library Regular expressions library (C++11) Atomic operations library (C++11) Thread support library (C++11)

Numerics library
 Common mathematical functions Floating-point environment Complex numbers Numeric arrays Pseudo-random number generation Compile-time rational arithmetic (C++11) Generic numeric operations iota (C++11) accumulate inner_product adjacent_difference partial_sum

Floating-point environment
 Functions feclearexcept (C++11) fetestexcept (C++11) feraiseexcept (C++11) fegetexceptflagfesetexceptflag (C++11)(C++11) fegetroundfesetround (C++11)(C++11) fegetenvfesetenv (C++11) feholdexcept (C++11) feupdateenv (C++11) Macro constants FE_DFL_ENV (C++11)

The floating-point environment is the set of floating-point status flags and control modes supported by the implementation. It is thread-local, each thread inherits the initial state of its floating-point environment from the parent thread. Floating-point operations modify the floating-point status flags to indicate abnormal results or auxiliary information. The state of floating-point control modes affects the outcomes of some floating-point operations.

The floating-point environment access and modification is only meaningful when #pragma STDC FENV_ACCESS is set to `ON`. Otherwise the implementation is free to assume that floating-point control modes are always the default ones and that floating-point status flags are never tested or modified. In practice, few current compilers support the `#pragma` explicitly, but most compilers allow meaningful access to the floating-point environment anyway.

## Contents

### Types

 Defined in header `` fenv_t The type representing the entire floating-point environment fexcept_t The type representing all floating-point status flags collectively

### Functions

 feclearexcept (C++11) clears the specified floating-point status flags (function) fetestexcept (C++11) determines which of the specified floating-point status flags are set (function) feraiseexcept (C++11) raises the specified floating-point exceptions (function) fegetexceptflagfesetexceptflag (C++11)(C++11) copies the state of the specified floating-point status flags from or to the floating-point environment (function) fegetroundfesetround (C++11)(C++11) gets or sets rounding direction (function) fegetenvfesetenv (C++11) saves or restores the current floating point environment (function) feholdexcept (C++11) saves the environment, clears all status flags and ignores all future errors (function) feupdateenv (C++11) restores the floating-point environment and raises the previously raise exceptions (function)

### Macros

 floating-point exceptions (macro constant) floating-point rounding direction (macro constant) FE_DFL_ENV (C++11) default floating-point environment (macro constant)
{"ft_lang_label":"__label__en","ft_lang_prob":0.793803,"math_prob":0.7527339,"size":2949,"snap":"2019-35-2019-39","text_gpt3_token_len":584,"char_repetition_ratio":0.24210526,"word_repetition_ratio":0.037783377,"special_character_ratio":0.20752798,"punctuation_ratio":0.05790646,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9543305,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2019-09-22T11:58:40Z\",\"WARC-Record-ID\":\"<urn:uuid:e5d7c55c-15c7-4b94-af42-29745571cfc7>\",\"Content-Length\":\"28227\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:d424a57c-a385-4fee-811e-8ade7c011740>\",\"WARC-Concurrent-To\":\"<urn:uuid:922bf70f-7ab3-4452-8c57-78073fb4a3fc>\",\"WARC-IP-Address\":\"147.232.41.75\",\"WARC-Target-URI\":\"https://kurzy.kpi.fei.tuke.sk/c-reference/en/cpp/numeric/fenv.html\",\"WARC-Payload-Digest\":\"sha1:L7MSHJABPNRXLKJ5VBU3VN4I2MJ43R4N\",\"WARC-Block-Digest\":\"sha1:76DZJEUGXR7HSY4QERQ5EOGF62QLVS6Z\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2019/CC-MAIN-2019-39/CC-MAIN-2019-39_segments_1568514575513.97_warc_CC-MAIN-20190922114839-20190922140839-00325.warc.gz\"}"}