From a1c5f64f3c8c9812cb0b4658630f79dab1856c0c Mon Sep 17 00:00:00 2001 From: Jaron Kent-Dobias Date: Tue, 25 Feb 2020 19:40:35 -0500 Subject: Fance inheritance --- mod.hpp | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 mod.hpp (limited to 'mod.hpp') diff --git a/mod.hpp b/mod.hpp new file mode 100644 index 0000000..f0da7c4 --- /dev/null +++ b/mod.hpp @@ -0,0 +1,10 @@ +#pragma once +#include + +double mod(double a, double b) { + if (a >= 0) { + return fmod(a, b); + } else { + return fmod(a + b * ceil(-a / b), b); + } +} -- cgit v1.2.3-54-g00ecf