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
7
class
DisableFPE
8
{
9
public
:
10
DisableFPE
()
11
{
12
fegetenv(&
fe_env
);
// Store floating-point exception handling.
13
fesetenv(FE_DFL_ENV);
// Set default environment effectively disabling
14
// exceptions.
15
}
16
17
~DisableFPE
()
18
{
19
fesetenv(&
fe_env
);
// Restore floating-point exception handling.
20
}
21
22
private
:
23
fenv_t
fe_env
;
24
};
25
26
#else
27
28
// No-op for Windows and Apple
29
class
DisableFPE
30
{
31
};
32
33
#endif
DisableFPE
Definition
DisableFPE.h:8
DisableFPE::~DisableFPE
~DisableFPE()
Definition
DisableFPE.h:17
DisableFPE::DisableFPE
DisableFPE()
Definition
DisableFPE.h:10
DisableFPE::fe_env
fenv_t fe_env
Definition
DisableFPE.h:23
BaseLib
DisableFPE.h
Generated by
1.14.0