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.9-30-g85b32d


From: Mark H Weaver
Subject: [Guile-commits] GNU Guile branch, stable-2.0, updated. v2.0.9-30-g85b32d4
Date: Tue, 16 Jul 2013 08:02:02 +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=85b32d43e63bd2939ce3706f44a50f153ba01a46

The branch, stable-2.0 has been updated
       via  85b32d43e63bd2939ce3706f44a50f153ba01a46 (commit)
       via  ff5568389c037f7c7b5dff9505c69e7f586f95aa (commit)
       via  62460767e133b4516c30920a4ba705889fb99f18 (commit)
      from  284859c2f9b7072dd0bc1215d43663bb87858025 (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 85b32d43e63bd2939ce3706f44a50f153ba01a46
Author: Mark H Weaver <address@hidden>
Date:   Tue Jul 16 03:42:52 2013 -0400

    flfinite? applied to a NaN returns false.
    
    Fixes <http://bugs.gnu.org/14868>.
    Reported by Göran Weinholt <address@hidden>.
    
    * module/rnrs/arithmetic/flonums.scm (flfinite?): If the argument is a
      NaN, return false.
    
    * test-suite/tests/r6rs-arithmetic-flonums.test (flfinite?): Add test.

commit ff5568389c037f7c7b5dff9505c69e7f586f95aa
Author: Mark H Weaver <address@hidden>
Date:   Tue Jul 16 03:38:27 2013 -0400

    flonum? returns false for complex number objects.
    
    Fixes <http://bugs.gnu.org/14866>.
    Reported by Göran Weinholt <address@hidden>.
    
    * module/rnrs/arithmetic/flonums.scm (flonum?): Use 'real?' instead of
      'number?'.
    
    * test-suite/tests/r6rs-arithmetic-flonums.test (flonum?): Add tests.

commit 62460767e133b4516c30920a4ba705889fb99f18
Author: Mark H Weaver <address@hidden>
Date:   Tue Jul 16 03:33:02 2013 -0400

    Allow fl+ and fl* to accept zero arguments.
    
    Fixes <http://bugs.gnu.org/14869>.
    Reported by Göran Weinholt <address@hidden>.
    
    * module/rnrs/arithmetic/flonums.scm (fl+, fl*): Accept zero arguments.
    
    * test-suite/tests/r6rs-arithmetic-flonums.test (fl+, fl*): Add tests.

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

Summary of changes:
 module/rnrs/arithmetic/flonums.scm            |   18 ++++++++----------
 test-suite/tests/r6rs-arithmetic-flonums.test |   16 ++++++++++++----
 2 files changed, 20 insertions(+), 14 deletions(-)

diff --git a/module/rnrs/arithmetic/flonums.scm 
b/module/rnrs/arithmetic/flonums.scm
index b65c294..be59295 100644
--- a/module/rnrs/arithmetic/flonums.scm
+++ b/module/rnrs/arithmetic/flonums.scm
@@ -66,7 +66,7 @@
          (rnrs lists (6))
          (rnrs r5rs (6)))
 
-  (define (flonum? obj) (and (number? obj) (inexact? obj)))
+  (define (flonum? obj) (and (real? obj) (inexact? obj)))
   (define (assert-flonum . args)
     (or (for-all flonum? args) (raise (make-assertion-violation))))
   (define (assert-iflonum . args)
@@ -89,7 +89,7 @@
   (define (flnegative? fl) (assert-flonum fl) (negative? fl))
   (define (flodd? ifl) (assert-iflonum ifl) (odd? ifl))
   (define (fleven? ifl) (assert-iflonum ifl) (even? ifl))
-  (define (flfinite? fl) (assert-flonum fl) (not (inf? fl)))
+  (define (flfinite? fl) (assert-flonum fl) (not (or (inf? fl) (nan? fl))))
   (define (flinfinite? fl) (assert-flonum fl) (inf? fl))
   (define (flnan? fl) (assert-flonum fl) (nan? fl))
 
@@ -103,15 +103,13 @@
       (apply assert-flonum flargs)
       (apply min flargs)))
 
-  (define (fl+ fl1 . args)
-    (let ((flargs (cons fl1 args)))
-      (apply assert-flonum flargs)
-      (apply + flargs)))
+  (define (fl+ . args)
+    (apply assert-flonum args)
+    (if (null? args) 0.0 (apply + args)))
 
-  (define (fl* fl1 . args)
-    (let ((flargs (cons fl1 args)))
-      (apply assert-flonum flargs)
-      (apply * flargs)))
+  (define (fl* . args)
+    (apply assert-flonum args)
+    (if (null? args) 1.0 (apply * args)))
 
   (define (fl- fl1 . args)
     (let ((flargs (cons fl1 args)))
diff --git a/test-suite/tests/r6rs-arithmetic-flonums.test 
b/test-suite/tests/r6rs-arithmetic-flonums.test
index af9dbbf..0be504f 100644
--- a/test-suite/tests/r6rs-arithmetic-flonums.test
+++ b/test-suite/tests/r6rs-arithmetic-flonums.test
@@ -30,7 +30,10 @@
   (pass-if "flonum? is #t on flonum"
     (flonum? 1.5))
 
-  (pass-if "flonum? is #f on non-flonum"
+  (pass-if "flonum? is #f on complex"
+    (not (flonum? 1.5+0.0i)))
+
+  (pass-if "flonum? is #f on exact integer"
     (not (flonum? 3))))
 
 (with-test-prefix "real->flonum"
@@ -139,7 +142,10 @@
     (flfinite? 2.0))
 
   (pass-if "flfinite? is #f on infinities"
-    (and (not (flfinite? +inf.0)) (not (flfinite? -inf.0)))))
+    (and (not (flfinite? +inf.0)) (not (flfinite? -inf.0))))
+
+  (pass-if "flfinite? is #f on NaNs"
+    (not (flfinite? +nan.0))))
 
 (with-test-prefix "flinfinite?"
   (pass-if "flinfinite? is #t on infinities"
@@ -162,10 +168,12 @@
   (pass-if "simple" (fl=? (flmin -1.0 0.0 2.0) -1.0)))
 
 (with-test-prefix "fl+"
-  (pass-if "simple" (fl=? (fl+ 2.141 1.0 0.1) 3.241)))
+  (pass-if "simple" (fl=? (fl+ 2.141 1.0 0.1) 3.241))
+  (pass-if "zero args" (fl=? (fl+) 0.0)))
 
 (with-test-prefix "fl*"
-  (pass-if "simple" (fl=? (fl* 1.0 2.0 3.0 1.5) 9.0)))
+  (pass-if "simple" (fl=? (fl* 1.0 2.0 3.0 1.5) 9.0))
+  (pass-if "zero args" (fl=? (fl*) 1.0)))
 
 (with-test-prefix "fl-"
   (pass-if "unary fl- negates argument" (fl=? (fl- 2.0) -2.0))


hooks/post-receive
-- 
GNU Guile



reply via email to

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