negative?, positive?, odd?, even?, flnegative?, flpositive?, flodd?, fleven?, fxnegative?, fxpositive?, fxodd?, fxeven? numerical predicates
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
(negative? x)
(positive? x)
(odd? n)
(even? n)
;; R6RS
(flnegative? fl)
(flpositive? fl)
(flodd? fl)
(fleven? fl)
(fxnegative? fx)
(fxpositive? fx)
(fxodd? fx)
(fxeven? fx)
DESCRIPTION
These numerical predicates test a number object for a particular
property, returning
#t or
#f.
 Properties tested

The predicates tests the following properties.
[1mzero? [22mtests if the number is = to zero
[1mpositive? [22mtests if the number is greater than zero
[1mnegative? [22mtests if the number is less than zero
[1modd? [22mtests if the number is odd
[1meven? [22mtests if the number is even
 Flonum variants

These variants restrict their arguments to flonums.
 Fixnum variants

These variants restrict their arguments to fixnums.
Unless the number is exact, the results may be unreliable because a
small inaccuracy may affect the result.
RETURN VALUES
Returns a single value; a boolean.
EXAMPLES
(zero? +0.0) => #t
(zero? 0.0) => #t
(zero? +nan.0) => #f
(positive? +inf.0) => #t
(negative? inf.0) => #t
(positive? +nan.0) => #f
(negative? +nan.0) => #f
COMPATIBILITY
These procedures work the same in all Scheme revisions since R2RS.
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),
finite?(3scm)
STANDARDS
R4RS,
IEEE Scheme,
R5RS,
R6RS,
R7RS
HISTORY
These procedures were first introduced in R2RS. Scheme before then,
running on MacLisp, had access to similar predicates:
zerop,
plusp,
minusp,
and
oddp.
LISP 1.5 had a
minusp
predicate that returned true for negative numbers, including 0.
It also had
zerop
and
onep
predicates. These were specified to true when the absolute difference
between the argument and zero or one, respectively, is less than 3e6.
AUTHORS
This page is part of the
schememanpages
project.
It includes materials from the RnRS documents.
More information can be found at
https://github.com/schemedoc/manpages/
.
Markup created by unroff 1.0sc, March 04, 2023.