aboutsummaryrefslogtreecommitdiff
path: root/src/openvic/utility/FloatUtils.hpp
diff options
context:
space:
mode:
author Hop311 <hop3114@gmail.com>2023-08-24 01:32:23 +0200
committer Hop311 <hop3114@gmail.com>2023-08-24 01:32:23 +0200
commitefa88c722fcb6c8fea7a86e1b3b8a83f1f59eb31 (patch)
tree0d64199bf4f19fabaaff083b35aa8625823d6c1e /src/openvic/utility/FloatUtils.hpp
parent6f4a6c77c6f2613e65a403c3a2964d5041a538c7 (diff)
Big Dataloader Commit (openvic-simulation)
Diffstat (limited to 'src/openvic/utility/FloatUtils.hpp')
-rw-r--r--src/openvic/utility/FloatUtils.hpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/openvic/utility/FloatUtils.hpp b/src/openvic/utility/FloatUtils.hpp
new file mode 100644
index 0000000..4fc83fd
--- /dev/null
+++ b/src/openvic/utility/FloatUtils.hpp
@@ -0,0 +1,11 @@
+#include <cstdint>
+
+namespace OpenVic::FloatUtils {
+ constexpr int round_to_int(double num) {
+ return (num > 0.0) ? (num + 0.5) : (num - 0.5);
+ }
+
+ constexpr int64_t round_to_int64(double num) {
+ return (num > 0.0) ? (num + 0.5) : (num - 0.5);
+ }
+}