diff options
Diffstat (limited to 'mod.hpp')
-rw-r--r-- | mod.hpp | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -0,0 +1,10 @@ +#pragma once +#include <cmath> + +double mod(double a, double b) { + if (a >= 0) { + return fmod(a, b); + } else { + return fmod(a + b * ceil(-a / b), b); + } +} |