mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-18 01:30:27 +02:00
Implement 'exact-integer?' and 'scm_is_exact_integer'.
* libguile/numbers.c (scm_exact_integer_p, scm_is_exact_integer): New procedures. (scm_integer_p): Improve docstring. * libguile/numbers.h (scm_exact_integer_p, scm_is_exact_integer): New prototypes. * doc/ref/api-data.texi (Integers): Add docs. * test-suite/tests/numbers.test ("exact-integer?"): Add tests.
This commit is contained in:
parent
f659df4495
commit
900a897cd3
4 changed files with 72 additions and 4 deletions
|
@ -1807,6 +1807,34 @@
|
|||
(pass-if (not (integer? (lambda () #t))))
|
||||
(pass-if (not (integer? (current-input-port)))))
|
||||
|
||||
;;;
|
||||
;;; integer?
|
||||
;;;
|
||||
|
||||
(with-test-prefix "exact-integer?"
|
||||
(pass-if (documented? exact-integer?))
|
||||
(pass-if (exact-integer? 0))
|
||||
(pass-if (exact-integer? 7))
|
||||
(pass-if (exact-integer? -7))
|
||||
(pass-if (exact-integer? (+ 1 fixnum-max)))
|
||||
(pass-if (exact-integer? (- 1 fixnum-min)))
|
||||
(pass-if (and (= 1.0 (round 1.0))
|
||||
(not (exact-integer? 1.0))))
|
||||
(pass-if (not (exact-integer? 1.3)))
|
||||
(pass-if (not (exact-integer? +inf.0)))
|
||||
(pass-if (not (exact-integer? -inf.0)))
|
||||
(pass-if (not (exact-integer? +nan.0)))
|
||||
(pass-if (not (exact-integer? +inf.0-inf.0i)))
|
||||
(pass-if (not (exact-integer? +nan.0+nan.0i)))
|
||||
(pass-if (not (exact-integer? 3+4i)))
|
||||
(pass-if (not (exact-integer? #\a)))
|
||||
(pass-if (not (exact-integer? "a")))
|
||||
(pass-if (not (exact-integer? (make-vector 0))))
|
||||
(pass-if (not (exact-integer? (cons 1 2))))
|
||||
(pass-if (not (exact-integer? #t)))
|
||||
(pass-if (not (exact-integer? (lambda () #t))))
|
||||
(pass-if (not (exact-integer? (current-input-port)))))
|
||||
|
||||
;;;
|
||||
;;; inexact?
|
||||
;;;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue