Previous: math library exceptions, Up: math


D.11.5 Additional math library notes

Floating point exceptions such as division by zero are not specifically reported as exceptions, but invalid computations can be detected by the propagation of nan into the result, following standard conventions.

The C function feclearexcept (FE_ALL_EXCEPT) is called before every floating point operation so that no lingering exception flags can affect it.

There is no library predicate for exact comparison of floating point numbers, but none is required because the virtual machine's compare combinator will work on their representations as it will on any other data. The usual caveats apply with regard to comparing floating point numbers in the presence of roundoff error.