OGS
DisableFPE.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) OpenGeoSys Community (opengeosys.org)
2// SPDX-License-Identifier: BSD-3-Clause
3
4#if !defined(_WIN32) && !defined(__APPLE__)
5#include <cfenv>
6
8{
9public:
11 {
12 fegetenv(&fe_env); // Store floating-point exception handling.
13 fesetenv(FE_DFL_ENV); // Set default environment effectively disabling
14 // exceptions.
15 }
16
18 {
19 fesetenv(&fe_env); // Restore floating-point exception handling.
20 }
21
22private:
23 fenv_t fe_env;
24};
25
26#else
27
28// No-op for Windows and Apple
29class DisableFPE
30{
31};
32
33#endif
fenv_t fe_env
Definition DisableFPE.h:23