summaryrefslogtreecommitdiff
path: root/libguile/numbers.c
diff options
context:
space:
mode:
authorMark H Weaver <mhw@netris.org>2015-07-22 20:56:18 -0400
committerAndy Wingo <wingo@pobox.com>2016-05-22 19:29:38 +0200
commitaa13da51892de89d3acdb84dce11699597a9fe05 (patch)
tree95405e2cb1548750f199fbfeaa92e467c9584886 /libguile/numbers.c
parentea8fa622ecc6e05520c21616b52949049d94f8a0 (diff)
Fix atan procedure when applied to complex numbers.
Fixes a regression introduced in commit ad79736c68a803a59814fbfc0cb4b092c2b4cddf. * libguile/numbers.c (scm_atan): Fix the complex case. * test-suite/tests/numbers.test ("atan"): Add test.
Diffstat (limited to 'libguile/numbers.c')
-rw-r--r--libguile/numbers.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libguile/numbers.c b/libguile/numbers.c
index 9cc72d269..d0f6e628d 100644
--- a/libguile/numbers.c
+++ b/libguile/numbers.c
@@ -8993,8 +8993,8 @@ SCM_PRIMITIVE_GENERIC (scm_atan, "atan", 1, 1, 0,
double v, w;
v = SCM_COMPLEX_REAL (z);
w = SCM_COMPLEX_IMAG (z);
- return scm_divide (scm_log (scm_divide (scm_c_make_rectangular (v, w - 1.0),
- scm_c_make_rectangular (v, w + 1.0))),
+ return scm_divide (scm_log (scm_divide (scm_c_make_rectangular (-v, 1.0 - w),
+ scm_c_make_rectangular ( v, 1.0 + w))),
scm_c_make_rectangular (0, 2));
}
else