Loading...
Searching...
No Matches
fpe_handler.h
Go to the documentation of this file.
1/*
2** This file is part of eOn.
3**
4** SPDX-License-Identifier: BSD-3-Clause
5**
6** Copyright (c) 2010--present, eOn Development Team
7** All rights reserved.
8**
9** Repo:
10** https://github.com/TheochemUI/eOn
11*/
12#pragma once
13
14#include <fenv.h>
15#include <mutex>
16
17namespace eonc {
18
19// Floating Point Trapping. It is platform specific!
20// This causes the program to crash on divison by zero,
21// invalid operations, and overflows.
22void enableFPE(void);
23void disableFPE(void);
24
26public:
27 // Fix for gh-184, see
28 // https://github.com/numpy/numpy/issues/20504#issuecomment-985542508
29 void eat_fpe();
30 void restore_fpe();
31
32private:
33 fenv_t orig_feenv;
34 std::mutex mutex_;
35};
36
37} // namespace eonc
std::mutex mutex_
Definition fpe_handler.h:34
RAII resource manager for the ARTn C library with global synchronization.
void enableFPE()
void disableFPE()