mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-20 11:40:18 +02:00
Avoid cexp, whose C standard definition is mathematically incorrect
* libguile/numbers.c (scm_exp): Do not use cexp.
This commit is contained in:
parent
cc26b9de1d
commit
ecbded71bb
1 changed files with 5 additions and 5 deletions
|
@ -9593,13 +9593,13 @@ SCM_PRIMITIVE_GENERIC (scm_exp, "exp", 1, 0, 0,
|
|||
{
|
||||
if (SCM_COMPLEXP (z))
|
||||
{
|
||||
#if defined HAVE_COMPLEX_DOUBLE && defined HAVE_CEXP \
|
||||
&& defined (SCM_COMPLEX_VALUE)
|
||||
return scm_from_complex_double (cexp (SCM_COMPLEX_VALUE (z)));
|
||||
#else
|
||||
/* 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. */
|
||||
return scm_c_make_polar (exp (SCM_COMPLEX_REAL (z)),
|
||||
SCM_COMPLEX_IMAG (z));
|
||||
#endif
|
||||
}
|
||||
else if (SCM_NUMBERP (z))
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue