#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); } }