summaryrefslogtreecommitdiff
path: root/libguile
diff options
context:
space:
mode:
Diffstat (limited to 'libguile')
-rw-r--r--libguile/ChangeLog5
-rw-r--r--libguile/numbers.c29
2 files changed, 34 insertions, 0 deletions
diff --git a/libguile/ChangeLog b/libguile/ChangeLog
index 19339a97d..6f5984f5d 100644
--- a/libguile/ChangeLog
+++ b/libguile/ChangeLog
@@ -1,3 +1,8 @@
+2007-04-09 Han-Wen Nienhuys <hanwen@lilypond.org>
+
+ * numbers.c (carg): provide carg, cexp, clog in case they are
+ missing.
+
2007-03-12 Ludovic Courtès <ludovic.courtes@laas.fr>
* i18n.c (scm_nl_langinfo): `#ifdef'd uses of `GROUPING',
diff --git a/libguile/numbers.c b/libguile/numbers.c
index a0ef29cdd..4454a342c 100644
--- a/libguile/numbers.c
+++ b/libguile/numbers.c
@@ -5997,6 +5997,35 @@ scm_is_number (SCM z)
return scm_is_true (scm_number_p (z));
}
+#if HAVE_COMPLEX_DOUBLE
+#if !HAVE_CLOG
+complex double clog (complex double z);
+complex double
+clog (complex double z)
+{
+ return log(cabs(z))+I*carg(z);
+}
+#endif
+
+#if !HAVE_CEXP
+complex double cexp (complex double z);
+complex double
+cexp (complex double z)
+{
+ return exp (cabs (z)) * cos(carg (z) + I*sin(carg (z)));
+}
+#endif
+
+#if !HAVE_CARG
+double carg (complex double z);
+double
+carg (complex double z)
+{
+ return atan2 (cimag(z), creal(z));
+}
+#endif
+#endif HAVE_COMPLEX_DOUBLE
+
/* In the following functions we dispatch to the real-arg funcs like log()
when we know the arg is real, instead of just handing everything to