aboutsummaryrefslogtreecommitdiffstats
path: root/math/imaxdiv.c
diff options
context:
space:
mode:
Diffstat (limited to 'math/imaxdiv.c')
-rw-r--r--math/imaxdiv.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/math/imaxdiv.c b/math/imaxdiv.c
new file mode 100644
index 0000000..52b5d39
--- /dev/null
+++ b/math/imaxdiv.c
@@ -0,0 +1,7 @@
+#include "maths.h"
+
+imaxdiv_t imaxdiv(intmax_t numerator, intmax_t denominator)
+{
+ return (imaxdiv_t){.quot = numerator / denominator,
+ .rem = numerator % denominator};
+}