dlinear  0.0.1
Delta-complete SMT solver for linear programming
Loading...
Searching...
No Matches
RoundingModeGuard.hpp
1
8#pragma once
9
10#include <cfenv>
11
12namespace dlinear {
13
15 public:
17 explicit RoundingModeGuard(int new_round) : round_mode_{fegetround()} { fesetround(new_round); }
18
19 RoundingModeGuard(const RoundingModeGuard &) = delete;
21 RoundingModeGuard &operator=(const RoundingModeGuard &) = delete;
22 RoundingModeGuard &operator=(RoundingModeGuard &&) = delete;
23
26
27 private:
28 const int round_mode_{};
29};
30
31} // namespace dlinear
RoundingModeGuard(int new_round)
Save the current rounding-mode and switch to new_round.
const int round_mode_
Saved rounding-mode stored at construction time, to be restored at destruction time.
Global namespace for the dlinear library.