From 6fdad9e0389cb51b5822fda2920f510cb9a8881a Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Wed, 7 Nov 2018 06:05:13 -0800 Subject: math: improve error diagnosis. More streamlined code, better identification of functions. * arith.c (not_number, not_integer, invalid_ops, invalid_op, divzero): New static functions. (num_to_buffer, bugnum_len, plus, minus, neg, abso, signum, mul, trunc1, mod, floordiv, round1, roundiv, divi, zerop, plusp, minusp, evenp, oddp, gt, lt, ge, le, numeq, expt, exptmod, floorf, ceili, sine, cosi, tang, asine, acosi, atang, loga, logten, logtwo, expo, sqroot, int_flo, flo_int, cum_norm_dist, inv_cum_norm): Establish function's Lisp name as self variable. Use new static functions for reporting common errors. Pass function name to new argument of c_flo function. * buf.c (buf_put_float, buf_put_double): Pass function's Lisp name to c_flo function. * ffi.c (ffi_float_put, ffi_double_put): Likewise. * lib.c (c_flo): Takes new argument, name of calling function. * lib.h (c_flo): Declaration updated. * stream.c (formatv): Pass function name to c_flo. --- lib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib.c') diff --git a/lib.c b/lib.c index 1af27139..0ab7085b 100644 --- a/lib.c +++ b/lib.c @@ -3153,7 +3153,7 @@ val flo(double n) return obj; } -double c_flo(val num) +double c_flo(val num, val self) { type_check(num, FLNUM); return num->fl.n; -- cgit v1.2.3