mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-10 22:10:21 +02:00
flfinite? applied to a NaN returns false.
Fixes <http://bugs.gnu.org/14868>. Reported by Göran Weinholt <goran@weinholt.se>. * module/rnrs/arithmetic/flonums.scm (flfinite?): If the argument is a NaN, return false. * test-suite/tests/r6rs-arithmetic-flonums.test (flfinite?): Add test.
This commit is contained in:
parent
ff5568389c
commit
85b32d43e6
2 changed files with 5 additions and 2 deletions
|
@ -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))
|
||||
|
||||
|
|
|
@ -142,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"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue