[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] GNU Guile branch, stable-2.0, updated. v2.0.6-2-g10a9775
From: |
Mark H Weaver |
Subject: |
[Guile-commits] GNU Guile branch, stable-2.0, updated. v2.0.6-2-g10a9775 |
Date: |
Sat, 28 Jul 2012 06:49:44 +0000 |
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Guile".
http://git.savannah.gnu.org/cgit/guile.git/commit/?id=10a97755d4a1b2034f8a131215a92c0b29000969
The branch, stable-2.0 has been updated
via 10a97755d4a1b2034f8a131215a92c0b29000969 (commit)
from abd731fff772624f54cdf69597b4cf36df9ae0e4 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 10a97755d4a1b2034f8a131215a92c0b29000969
Author: Mark H Weaver <address@hidden>
Date: Sat Jul 28 02:45:05 2012 -0400
Angle of -0.0 is pi, not zero
* libguile/numbers.c (scm_angle): Check the sign of an inexact real
zero, to ensure that (angle -0.0) => pi and (angle 0.0) => 0.0.
* test-suite/tests/numbers.test (angle): Add tests, and increase
precision of tests where the angle should be pi.
-----------------------------------------------------------------------
Summary of changes:
libguile/numbers.c | 3 ++-
test-suite/tests/numbers.test | 7 +++++--
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/libguile/numbers.c b/libguile/numbers.c
index 3458847..52e227f 100644
--- a/libguile/numbers.c
+++ b/libguile/numbers.c
@@ -8901,7 +8901,8 @@ SCM_PRIMITIVE_GENERIC (scm_angle, "angle", 1, 0, 0,
}
else if (SCM_REALP (z))
{
- if (SCM_REAL_VALUE (z) >= 0)
+ double x = SCM_REAL_VALUE (z);
+ if (x > 0.0 || double_is_non_negative_zero (x))
return flo0;
else
return scm_from_double (atan2 (0.0, -1.0));
diff --git a/test-suite/tests/numbers.test b/test-suite/tests/numbers.test
index b1f3d8b..a6697c9 100644
--- a/test-suite/tests/numbers.test
+++ b/test-suite/tests/numbers.test
@@ -4241,7 +4241,7 @@
(with-test-prefix "angle"
(define pi 3.14159265358979323846)
(define (almost= x y)
- (> 0.01 (magnitude (- x y))))
+ (> 0.000001 (magnitude (- x y))))
(pass-if (documented? angle))
@@ -4252,7 +4252,10 @@
(pass-if "bignum -ve" (almost= pi (angle (1- fixnum-min))))
(pass-if "flonum +ve" (= 0 (angle 1.5)))
- (pass-if "flonum -ve" (almost= pi (angle -1.5))))
+ (pass-if "flonum -ve" (almost= pi (angle -1.5)))
+
+ (pass-if "signed zero +ve" (= 0 (angle 0.0)))
+ (pass-if "signed zero -ve" (almost= pi (angle -0.0))))
;;;
;;; inexact->exact
hooks/post-receive
--
GNU Guile
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Guile-commits] GNU Guile branch, stable-2.0, updated. v2.0.6-2-g10a9775,
Mark H Weaver <=