From 45fe65bb4305b896ac95bfa70c3273662e8e44f1 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Sat, 7 Feb 2015 19:58:38 -0800 Subject: * arith.c (trunc_rem): New function. * eval.c (eval_init): Register trunc-rem intrinsic. * lib.h (trunc_rem): Declared. * txr.1: Documented trunc-rem. * tl.vim, txr.vim: Updated. --- arith.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'arith.c') diff --git a/arith.c b/arith.c index 20d1ae3b..9aeb0875 100644 --- a/arith.c +++ b/arith.c @@ -945,6 +945,13 @@ divzero: uw_throw(numeric_error_s, lit("mod: division by zero")); } +val trunc_rem(val anum, val bnum) +{ + val quot = trunc(anum, bnum); + val rem = minus(anum, mul(quot, bnum)); + return list(quot, rem, nao); +} + val wrap_star(val start, val end, val num) { val modulus = minus(end, start); -- cgit v1.2.3