Detailed Description

The C Math Library module provides transactional implementations of typical C math functions, such ar sqrt() or pow(). The functions in this module can simply be invoked without further configuration. Most of them don't have any state besides error reporting and the floating-point environment. All functions instrument the TM module for privatizing argument buffers, and instrument libc for saving errno.

The C Math Library maintains two global states. These are the floating-point environment and the floating-point status flags.

The floating-point environment contains configuration flags for operations that involve floating-point arithmetics. A typical example is the rounding mode.

All functions in libm handle these state variables automatically. If you implement an external module that modifies these states, libm offers two interface for saving the states. Call picotm_libm_save_fenv() to save the floating-point environment, and call picotm_libm_save_fexcept() to save the floating-point status flags. This will save and restore each state when necessary.