mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-10 14:00:21 +02:00
flonum? returns false for complex number objects.
Fixes <http://bugs.gnu.org/14866>. Reported by Göran Weinholt <goran@weinholt.se>. * module/rnrs/arithmetic/flonums.scm (flonum?): Use 'real?' instead of 'number?'. * test-suite/tests/r6rs-arithmetic-flonums.test (flonum?): Add tests.
This commit is contained in:
parent
62460767e1
commit
ff5568389c
2 changed files with 5 additions and 2 deletions
|
@ -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)
|
||||
|
|
|
@ -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"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue