guile-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Guile-commits] GNU Guile branch, stable-2.0, updated. v2.0.0-166-g6ebec


From: Mark H Weaver
Subject: [Guile-commits] GNU Guile branch, stable-2.0, updated. v2.0.0-166-g6ebecde
Date: Wed, 06 Apr 2011 22:30:25 +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=6ebecdeb7da37a1ff0ab1d01e2f2fec225667a74

The branch, stable-2.0 has been updated
       via  6ebecdeb7da37a1ff0ab1d01e2f2fec225667a74 (commit)
      from  ce6066065dda2cf1854f6a63324abb75dc0bc23f (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 6ebecdeb7da37a1ff0ab1d01e2f2fec225667a74
Author: Mark H Weaver <address@hidden>
Date:   Wed Apr 6 18:24:40 2011 -0400

    Fix parsing of exact numbers with negative exponents
    
    * libguile/numbers.c (mem2decimal_from_point): Use scm_divide instead of
      scm_divide2real when applying a negative exponent, to preserve
      exactness in case the "#e" forced exactness specifier is present.
      This fixes a bug where numeric literals such as "#e1e-5" yielded
      incorrect fractions.

-----------------------------------------------------------------------

Summary of changes:
 libguile/numbers.c            |    2 +-
 test-suite/tests/numbers.test |    5 +++++
 2 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/libguile/numbers.c b/libguile/numbers.c
index 427e772..b4f2242 100644
--- a/libguile/numbers.c
+++ b/libguile/numbers.c
@@ -5668,7 +5668,7 @@ mem2decimal_from_point (SCM result, SCM mem,
          if (sign == 1)
            result = scm_product (result, e);
          else
-           result = scm_divide2real (result, e);
+           result = scm_divide (result, e);
 
          /* We've seen an exponent, thus the value is implicitly inexact. */
          x = INEXACT;
diff --git a/test-suite/tests/numbers.test b/test-suite/tests/numbers.test
index 9584294..d94b6a1 100644
--- a/test-suite/tests/numbers.test
+++ b/test-suite/tests/numbers.test
@@ -1456,6 +1456,11 @@
     (pass-if (string=? (number->string 35 36) "z"))
     (pass-if (= (num->str->num 35 36) 35))
 
+    ;; Before Guile 2.0.1, even in the presence of a #e forced exactness
+    ;; specifier, negative exponents were applied inexactly and then
+    ;; later coerced to exact, yielding an incorrect fraction.
+    (pass-if (eqv? (string->number "#e1e-10") 1/10000000000))
+
     ;; Numeric conversion from decimal is not precise, in its current
     ;; implementation, so 11.333... and 1.324... can't be expected to
     ;; reliably come out to precise values.  These tests did actually work


hooks/post-receive
-- 
GNU Guile



reply via email to

[Prev in Thread] Current Thread [Next in Thread]