### 1.1 Error Handling ¶

There are two different versions of the math library routines: IEEE and POSIX. The version may be selected at runtime by setting the global variable `_LIB_VERSION`, defined in `math.h`. It may be set to one of the following constants defined in `math.h`: `_IEEE_` or `_POSIX_`. The `_LIB_VERSION` variable is not specific to any thread, and changing it will affect all threads.

The versions of the library differ only in the setting of `errno`.

In IEEE mode, `errno` is never set.

In POSIX mode, `errno` is set correctly.

The library is set to IEEE mode by default.

The majority of the floating-point math functions are written so as to produce the floating-point exceptions (e.g. "invalid", "divide-by-zero") as required by the C and POSIX standards, for floating-point implementations that support them. Newlib does not provide the floating-point exception access routines defined in the standards for fenv.h, though, which is why they are considered unsupported. It is mentioned in case you have separately-provided access routines so that you are aware that they can be caused.

### 1.2 Standards Compliance And Portability ¶

Most of the individual function descriptions describe the standards to which each function complies. However, these descriptions are mostly out of date, having been written before C99 was released. One of these days we’ll get around to updating the rest of them. (If you’d like to help, please let us know.)

“C99” refers to ISO/IEC 9899:1999, “Programming languages–C”. “POSIX” refers to IEEE Standard 1003.1. POSIX® is a registered trademark of The IEEE.