summaryrefslogtreecommitdiff
path: root/libguile/numbers.h
diff options
context:
space:
mode:
authorMark H Weaver <mhw@netris.org>2011-01-30 09:52:51 -0500
committerAndy Wingo <wingo@pobox.com>2011-01-30 23:06:07 +0100
commit2519490c50ae063ef27201c5403e80628fff9eeb (patch)
tree517c01cb1cb94ecc587bb5aa9b7f9e12d44bd61c /libguile/numbers.h
parentff62c16828d41955455805dd1b427966944b7d27 (diff)
downloadguile-2519490c50ae063ef27201c5403e80628fff9eeb.tar.gz
Improve extensibility of core numeric procedures
* libguile/numbers.c (scm_quotient, scm_remainder, scm_modulo, scm_zero_p, scm_positive_p, scm_negative_p, scm_real_part, scm_imag_part, scm_numerator, scm_denominator, scm_magnitude, scm_angle, scm_exact_to_inexact): Change from SCM_GPROC to SCM_PRIMITIVE_GENERIC. As a side effect, all of these procedures now have documentation strings. (scm_exact_p, scm_inexact_p, scm_odd_p, scm_even_p, scm_finite_p, scm_inf_p, scm_nan_p, scm_expt, scm_inexact_to_exact, scm_log, scm_log10, scm_exp, scm_sqrt): Change from SCM_DEFINE to SCM_PRIMITIVE_GENERIC, and make sure the code allows these functions to be extended in practice. (scm_real_part, scm_imag_part, scm_numerator, scm_denominator, scm_inexact_to_exact): Simplify type dispatch code. (scm_sqrt): Rename formal argument from x to z, since complex numbers are supported. (scm_abs): Fix empty FUNC_NAME. * libguile/numbers.h (scm_finite_p): Add missing prototype. (scm_inf_p, scm_nan_p): Rename formal parameter from n to x, since the domain is the real numbers. * test-suite/tests/numbers.test: Test for documentation strings. Change from `expect-fail' to `pass-if' for several of these, and add tests for others. Also add other tests for `real-part' and `imag-part', which previously had none.
Diffstat (limited to 'libguile/numbers.h')
-rw-r--r--libguile/numbers.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/libguile/numbers.h b/libguile/numbers.h
index 76d2972e2..2cf3fd763 100644
--- a/libguile/numbers.h
+++ b/libguile/numbers.h
@@ -169,8 +169,9 @@ typedef struct scm_t_complex
SCM_API SCM scm_exact_p (SCM x);
SCM_API SCM scm_odd_p (SCM n);
SCM_API SCM scm_even_p (SCM n);
-SCM_API SCM scm_inf_p (SCM n);
-SCM_API SCM scm_nan_p (SCM n);
+SCM_API SCM scm_finite_p (SCM x);
+SCM_API SCM scm_inf_p (SCM x);
+SCM_API SCM scm_nan_p (SCM x);
SCM_API SCM scm_inf (void);
SCM_API SCM scm_nan (void);
SCM_API SCM scm_abs (SCM x);