diff options
author | Andy Wingo <wingo@pobox.com> | 2009-09-03 22:29:10 +0200 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2009-12-03 15:27:35 +0100 |
commit | ad79736c68a803a59814fbfc0cb4b092c2b4cddf (patch) | |
tree | 912f8bb670bae32bfe48b2b0e7dc73491168a9bd /libguile/deprecated.c | |
parent | 6fc4d0124d633d1b3ddc5af82967f23bd17556f8 (diff) | |
download | guile-ad79736c68a803a59814fbfc0cb4b092c2b4cddf.tar.gz |
implement transcendental sin, cos etc in c; deprecate $sin, $cos, etc
* libguile/deprecated.h:
* libguile/deprecated.c (scm_asinh, scm_acosh, scm_atanh): Deprecate
these stand-ins for the C99 asinh, acosh, and atanh functions. Guile
is not gnulib.
(scm_sys_atan2): Deprecate as well, in favor of scm_atan.
* libguile/numbers.h:
* libguile/numbers.c (scm_sin, scm_cos, scm_tan)
(scm_sinh, scm_cosh, scm_tanh)
(scm_asin, scm_acos, scm_atan)
(scm_sys_asinh, scm_sys_acosh, scm_sys_atanh): New functions,
replacing the combination of dsubrs and boot-9 wrappers with C subrs
that handle complex values. The latter three have _sys_ in their names
due to the name conflict with the deprecated scm_asinh et al.
Remove the $abs, $sin etc "dsubrs".
* module/ice-9/boot-9.scm: Remove transcendental functions, as this all
happens in C now.
* module/ice-9/deprecated.scm: Add aliases for $sin et al.
* test-suite/tests/ramap.test ("array-map!"): Adjust "dsubr" tests to
use sqrt, not $sqrt. They don't actually test dsubrs now. In the
two-source test, I'm pretty sure the dsubr array-map! should have been
failing, as indeed it does now; I've changed the test case to expect
the failure. I'd still like to know why it was succeeding before.
Diffstat (limited to 'libguile/deprecated.c')
-rw-r--r-- | libguile/deprecated.c | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/libguile/deprecated.c b/libguile/deprecated.c index 0b6d83f49..9364a6939 100644 --- a/libguile/deprecated.c +++ b/libguile/deprecated.c @@ -55,6 +55,7 @@ #include "libguile/socket.h" #include "libguile/feature.h" +#include <math.h> #include <stdio.h> #include <string.h> @@ -1223,6 +1224,50 @@ scm_sys_expt (SCM x, SCM y) return scm_expt (x, y); } +double +scm_asinh (double x) +{ + scm_c_issue_deprecation_warning + ("scm_asinh is deprecated. Use asinh instead."); +#if HAVE_ASINH + return asinh (x); +#else + return log (x + sqrt (x * x + 1)); +#endif +} + +double +scm_acosh (double x) +{ + scm_c_issue_deprecation_warning + ("scm_acosh is deprecated. Use acosh instead."); +#if HAVE_ACOSH + return acosh (x); +#else + return log (x + sqrt (x * x - 1)); +#endif +} + +double +scm_atanh (double x) +{ + scm_c_issue_deprecation_warning + ("scm_atanh is deprecated. Use atanh instead."); +#if HAVE_ATANH + return atanh (x); +#else + return 0.5 * log ((1 + x) / (1 - x)); +#endif +} + +SCM +scm_sys_atan2 (SCM z1, SCM z2) +{ + scm_c_issue_deprecation_warning + ("scm_sys_atan2 is deprecated. Use scm_atan instead."); + return scm_atan (z1, z2); +} + char * scm_i_deprecated_symbol_chars (SCM sym) { |