From efa88c722fcb6c8fea7a86e1b3b8a83f1f59eb31 Mon Sep 17 00:00:00 2001 From: Hop311 Date: Thu, 24 Aug 2023 00:32:23 +0100 Subject: Big Dataloader Commit (openvic-simulation) --- src/openvic/utility/FloatUtils.hpp | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 src/openvic/utility/FloatUtils.hpp (limited to 'src/openvic/utility/FloatUtils.hpp') 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 + +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); + } +} -- cgit v1.2.3-56-ga3b1