1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-20 11:40:18 +02:00

Fix atan procedure when applied to complex numbers.

Fixes a regression introduced in commit
ad79736c68.

* libguile/numbers.c (scm_atan): Fix the complex case.
* test-suite/tests/numbers.test ("atan"): Add test.
This commit is contained in:
Mark H Weaver 2015-07-22 20:56:18 -04:00 committed by Andy Wingo
parent ea8fa622ec
commit aa13da5189
2 changed files with 6 additions and 5 deletions

View file

@ -8993,8 +8993,8 @@ SCM_PRIMITIVE_GENERIC (scm_atan, "atan", 1, 1, 0,
double v, w; double v, w;
v = SCM_COMPLEX_REAL (z); v = SCM_COMPLEX_REAL (z);
w = SCM_COMPLEX_IMAG (z); w = SCM_COMPLEX_IMAG (z);
return scm_divide (scm_log (scm_divide (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, w + 1.0))), scm_c_make_rectangular ( v, 1.0 + w))),
scm_c_make_rectangular (0, 2)); scm_c_make_rectangular (0, 2));
} }
else else

View file

@ -1,6 +1,6 @@
;;;; numbers.test --- tests guile's numbers -*- scheme -*- ;;;; numbers.test --- tests guile's numbers -*- scheme -*-
;;;; Copyright (C) 2000, 2001, 2003, 2004, 2005, 2006, 2009, 2010, 2011, ;;;; Copyright (C) 2000, 2001, 2003-2006, 2009-2013,
;;;; 2012, 2013 Free Software Foundation, Inc. ;;;; 2015 Free Software Foundation, Inc.
;;;; ;;;;
;;;; This library is free software; you can redistribute it and/or ;;;; This library is free software; you can redistribute it and/or
;;;; modify it under the terms of the GNU Lesser General Public ;;;; 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 (atan 0)))
(pass-if (eqv? 0.0 (atan 0.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.57 (atan -inf.0)))
(pass-if (eqv-loosely? -1.42+0.5i (atan -0.5+2.0i))))
;;; ;;;
;;; sinh ;;; sinh