exact?, inexact?, exact-integer? - exactness predicates
(import (rnrs)) ;R6RS
(import (rnrs base)) ;R6RS
(import (scheme r5rs)) ;R7RS
(import (scheme base)) ;R7RS
(exact? z)
(inexact? z)
(exact-integer? z) ;R7RS
The exact? and inexact? predicates provide tests for the exactness
of a quantity. For any number object, precisely one of these predicates is
true.
The exact-integer? procedure returns #t if z
is both exact and an integer, and #f otherwise.
Returns a single boolean object.
(exact? 5) => #t
(exact? 3.0) => #f
(exact? #e3.0) => #t
(inexact? 3.) => #t
(inexact? +inf.0) => #t
(exact-integer? 32) => #t ;R7RS
(exact-integer? 32.0) => #f ;R7RS
(exact-integer? 32/5) => #f ;R7RS
The exact-integer? procedure is new in R7RS and is absent from R6RS.
This procedure can raise exceptions with the following condition types:
- &assertion (R6RS)
- The wrong number of arguments was passed or an argument was outside its
domain. In particular, the argument to exact? or inexact?
must be a number object.
- R7RS
- The assertions described above are errors. Implementations may signal an
error, extend the procedure's domain of definition to include such
arguments, or fail catastrophically.
R4RS, IEEE Scheme, R5RS, R6RS, R7RS
The exact? and inexact? procedures first appeared in R2RS.