zero?, flzero?, fxzero? - test if a number is zero
LIBRARY
(import (rnrs)) ;R6RS
(import (rnrs base)) ;R6RS
(import (scheme r5rs)) ;R7RS
(import (scheme base)) ;R7RS
(import (rnrs arithmetic flonums)) ;R6RS
(import (rnrs arithmetic fixnums)) ;R6RS
SYNOPSIS
(zero? z)
(flzero? fl)
(fxzero? fx)
DESCRIPTION
Test whether the number object z is zero. This procedure works
on all number objects, up to and including complex numbers.
The flzero? variant is restricted to flonums and the
fxzero? variant is restricted to fixnums.
RETURN VALUES
Returns #t if the number is zero, otherwise #f.
EXAMPLES
(zero? 0) => #t
(zero? 0.0) => #t
(zero? 0.0+0.0i) => #t
(zero? -1) => #f
(zero? 1/2) => #f
(fxzero? 0) => #t
(flzero? 0.0) => #t
(fxzero? 1/2) => &assertion
(flzero? 1/2) => &assertion
APPLICATION USAGE
Used as a shorthand for (= x 0). Use with higher-order functions
is rare.
COMPATIBILITY
The description is the same in all Scheme reports. Compatibility will
depend on general factors that affect the number system, such as
implementation support for complex numbers and IEEE 754 floating
point.
The restricted procedures are only specified in 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.
- 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
=(3scm),
>(3scm).
STANDARDS
R4RS,
IEEE Scheme,
R5RS,
R6RS,
R7RS
AUTHORS
This page is part of the
scheme-manpages
project.
It includes materials from the RnRS documents.
More information can be found at
https://github.com/schemedoc/manpages/
.
BUGS
This procedure should normally not be used on inexact numbers since
inaccuracies in computations makes its use unreliable.
Markup created by unroff 1.0sc, March 04, 2023.