Revert "Avoid cexp, whose C standard definition is mathematically incorrect"
authorMark H Weaver <mhw@tines.lan>
Tue, 7 Aug 2012 22:13:48 +0000 (18:13 -0400)
committerMark H Weaver <mhw@tines.lan>
Tue, 7 Aug 2012 22:13:48 +0000 (18:13 -0400)
This reverts commit ecbded71bb423a6055c541d6272796aefd1486f9.

libguile/numbers.c

index 3ea88ea..52e227f 100644 (file)
@@ -9593,13 +9593,13 @@ SCM_PRIMITIVE_GENERIC (scm_exp, "exp", 1, 0, 0,
 {
   if (SCM_COMPLEXP (z))
     {
-      /* Unfortunately we cannot use cexp() here, because both C99 and
-         C11 specify behavior for cexp() that is mathematically
-         incorrect.  In particular, they specify in annex G.6.3.1
-         that cexp(+inf.0+inf.0i) and cexp(+inf.0+nan.0i) return
-         +inf.0+nan.0i or -inf.0+nan.0i. */
+#if defined HAVE_COMPLEX_DOUBLE && defined HAVE_CEXP \
+  && defined (SCM_COMPLEX_VALUE)
+      return scm_from_complex_double (cexp (SCM_COMPLEX_VALUE (z)));
+#else
       return scm_c_make_polar (exp (SCM_COMPLEX_REAL (z)),
                                SCM_COMPLEX_IMAG (z));
+#endif
     }
   else if (SCM_NUMBERP (z))
     {