C言語の新しい規格であるISO C99では,
- 浮動小数点演算の丸め方
- 例外の取り扱い
を制御するために,11個の関数を定義している.
#include <fenv.h>
// 例外関係
int feclearexcept(int excepts);
int fegetexceptflag(fexcept_t *flagp, int excepts);
int feraiseexcept(int excepts);
int fesetexceptflag(const fexcept_t *flagp, int excepts);
int fetestexcept(int excepts);
// 丸め方
int fegetround(void);
int fesetround(int rounding_mode);
int fegetenv(fenv_t *envp);
int feholdexcept(fenv_t *envp);
int fesetenv(const fenv_t *envp);
int feupdateenv(const fenv_t *envp);