The C Math Library Module

Covers the C Math Library module. This module provides transactional C math functions, such `sqrt()`

or `pow()`

.
More...

## Files | |

file | complex.h |

Transactional wrappers for interfaces of <complex.h>. | |

file | math-tm.h |

Transactional wrappers for interfaces of <math.h>. | |

file | math.h |

Transactional wrappers for interfaces of <math.h>. | |

file | picotm-libm.h |

Public interfaces of picotm's libm module. | |

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.

The floating-point status flags signal errors during floating-point operations. Examples are overflow errors or divisions by zero.

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.