summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libguile/numbers.c4
-rw-r--r--test-suite/tests/numbers.test7
2 files changed, 6 insertions, 5 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
diff --git a/test-suite/tests/numbers.test b/test-suite/tests/numbers.test
index 847f93962..0adf21637 100644
--- a/test-suite/tests/numbers.test
+++ b/test-suite/tests/numbers.test
@@ -1,6 +1,6 @@
;;;; numbers.test --- tests guile's numbers -*- scheme -*-
-;;;; Copyright (C) 2000, 2001, 2003, 2004, 2005, 2006, 2009, 2010, 2011,
-;;;; 2012, 2013 Free Software Foundation, Inc.
+;;;; Copyright (C) 2000, 2001, 2003-2006, 2009-2013,
+;;;; 2015 Free Software Foundation, Inc.
;;;;
;;;; This library is free software; you can redistribute it and/or
;;;; modify it under the terms of the GNU Lesser General Public
@@ -4467,7 +4467,8 @@
(pass-if (eqv? 0 (atan 0)))
(pass-if (eqv? 0.0 (atan 0.0)))
(pass-if (eqv-loosely? 1.57 (atan +inf.0)))
- (pass-if (eqv-loosely? -1.57 (atan -inf.0))))
+ (pass-if (eqv-loosely? -1.57 (atan -inf.0)))
+ (pass-if (eqv-loosely? -1.42+0.5i (atan -0.5+2.0i))))
;;;
;;; sinh