| exact?(3scm) | Scheme Programmer's Manual | exact?(3scm) |
NAME
exact?, inexact?, exact-integer? - exactness predicates
LIBRARY
(import (rnrs)) ;R6RS (import (rnrs base)) ;R6RS (import (scheme r5rs)) ;R7RS (import (scheme base)) ;R7RS
SYNOPSIS
(exact? z) (inexact? z) (exact-integer? z) ;R7RS
DESCRIPTION
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.
RETURN VALUES
Returns a single boolean object.
EXAMPLES
(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
COMPATIBILITY
The exact-integer? procedure is new in R7RS and is absent from R6RS.
ERRORS
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.
SEE ALSO
STANDARDS
R4RS, IEEE Scheme, R5RS, R6RS, R7RS
HISTORY
The exact? and inexact? procedures first appeared in R2RS.
AUTHORS
This page is part of the scheme-manpages project. It includes materials from the RnRS documents. More information can be found at https://weinholt.se/scheme/manpages/.
| 2026-07-22 |