master
 1/**
 2 * This file has no copyright assigned and is placed in the Public Domain.
 3 * This file is part of the mingw-w64 runtime package.
 4 * No warranty is given; refer to the file DISCLAIMER.PD within this package.
 5 */
 6#include <fenv.h>
 7
 8/* 7.6.4.4
 9   The feupdateenv function saves the currently raised exceptions in
10   its automatic storage, installs the floating-point environment
11   represented by the object pointed to by envp, and then raises the
12   saved exceptions. The argument envp shall point to an object
13   set by a call to feholdexcept or fegetenv, or equal the macro
14   FE_DFL_ENV or an implementation-defined environment macro. */
15
16int feupdateenv(const fenv_t *env)
17{
18    int except = fetestexcept(FE_ALL_EXCEPT);
19    return fesetenv(env) || feraiseexcept(except);
20}
21