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
16 /* FIXME: this works but surely there must be a better way. */
17
feupdateenv(const fenv_t * envp)18 int feupdateenv (const fenv_t * envp)
19 {
20 unsigned int _fexcept = fetestexcept (FE_ALL_EXCEPT); /*save excepts */
21 fesetenv (envp); /* install the env */
22 feraiseexcept (_fexcept); /* raise the except */
23 return 0;
24 }
25
26