1 //===- llvm/System/FEnv.h - Host floating-point exceptions ------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file provides an operating system independent interface to
11 // floating-point exception interfaces.
13 //===----------------------------------------------------------------------===//
15 #ifndef LLVM_SYSTEM_FENV_H
16 #define LLVM_SYSTEM_FENV_H
18 #include "llvm/Config/config.h"
27 /// llvm_fenv_clearexcept - Clear the floating-point exception state.
28 static inline void llvm_fenv_clearexcept() {
30 feclearexcept(FE_ALL_EXCEPT);
35 /// llvm_fenv_testexcept - Test if a floating-point exception was raised.
36 static inline bool llvm_fenv_testexcept() {
37 int errno_val = errno;
38 if (errno_val == ERANGE || errno_val == EDOM)
41 if (fetestexcept(FE_ALL_EXCEPT & ~FE_INEXACT))
47 } // End sys namespace
48 } // End llvm namespace