[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] 17/47: Fix atan procedure when applied to complex number
From: |
Andy Wingo |
Subject: |
[Guile-commits] 17/47: Fix atan procedure when applied to complex numbers. |
Date: |
Sun, 22 May 2016 18:23:04 +0000 (UTC) |
wingo pushed a commit to branch master
in repository guile.
commit aa13da51892de89d3acdb84dce11699597a9fe05
Author: Mark H Weaver <address@hidden>
Date: Wed Jul 22 20:56:18 2015 -0400
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.
---
libguile/numbers.c | 4 ++--
test-suite/tests/numbers.test | 7 ++++---
2 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/libguile/numbers.c b/libguile/numbers.c
index 9cc72d2..d0f6e62 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 847f939..0adf216 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
- [Guile-commits] branch master updated (fd17cf9 -> 2badbd0), Andy Wingo, 2016/05/22
- [Guile-commits] 10/47: Handle zero-length bytevectors correctly in (system base types)., Andy Wingo, 2016/05/22
- [Guile-commits] 06/47: tests: Gracefully handle ENOSYS return for 'setaffinity'., Andy Wingo, 2016/05/22
- [Guile-commits] 02/47: http: Do not buffer HTTP chunks., Andy Wingo, 2016/05/22
- [Guile-commits] 16/47: doc: Fix parameter of 'set-record-type-printer!'., Andy Wingo, 2016/05/22
- [Guile-commits] 20/47: Clarify datum->syntax documentation., Andy Wingo, 2016/05/22
- [Guile-commits] 17/47: Fix atan procedure when applied to complex numbers.,
Andy Wingo <=
- [Guile-commits] 23/47: doc: Fix menu order for SXML., Andy Wingo, 2016/05/22
- [Guile-commits] 30/47: Add new Linux errno constants., Andy Wingo, 2016/05/22
- [Guile-commits] 29/47: Fix the rule to check for new signals and errors, Andy Wingo, 2016/05/22
- [Guile-commits] 35/47: doc: Mention a known-good Flex version number., Andy Wingo, 2016/05/22
- [Guile-commits] 27/47: web: Gracefully handle premature EOF when reading chunk header., Andy Wingo, 2016/05/22
- [Guile-commits] 36/47: build: Add SCM_T_OFF_MAX and SCM_T_OFF_MIN to scmconfig.h., Andy Wingo, 2016/05/22
- [Guile-commits] 22/47: doc: Add SXPath documentation from sources, Andy Wingo, 2016/05/22
- [Guile-commits] 26/47: docs: Fix external representation of <toplevel-define> in tree-il., Andy Wingo, 2016/05/22
- [Guile-commits] 25/47: web: Fix 'close' method of delimited input ports., Andy Wingo, 2016/05/22
- [Guile-commits] 40/47: http: Test that responses lacking CR/LF are rejected., Andy Wingo, 2016/05/22