(import (rnrs)) ;R6RS (import (rnrs base)) ;R6RS (import (scheme r5rs)) ;R7RS (import (scheme base)) ;R7RS (import (rnrs arithmetic fixnums)) ;R6RS (import (rnrs arithmetic flonums)) ;R6RS
(= z1 z2 z3 ...) (< x1 x2 x3 ...) (> x1 x2 x3 ...) (<= x1 x2 x3 ...) (>= x1 x2 x3 ...) (fl=? fl1 fl2 fl3 ...) (fl<? fl1 fl2 fl3 ...) (fl>? fl1 fl2 fl3 ...) (fl<=? fl1 fl2 fl3 ...) (fl>=? fl1 fl2 fl3 ...) (fx=? fx1 fx2 fx3 ...) (fx<? fx1 fx2 fx3 ...) (fx>? fx1 fx2 fx3 ...) (fx<=? fx1 fx2 fx3 ...) (fx>=? fx1 fx2 fx3 ...)
(= +inf.0 +inf.0) => #t (= -inf.0 +inf.0) => #f (= -inf.0 -inf.0) => #t
For any real number object x that is neither infinite nor NaN:
(< -inf.0 x +inf.0) => #t (> +inf.0 x -inf.0) => #t
(= +nan.0 z) => #f
For any real number object x:
(< +nan.0 x) => #f (> +nan.0 x) => #f
(= 0.0 -0.0) => #t (< 0.0 -0.0) => #f
Negative zero can be distinguished with eqv?(3scm). Implementations are not required to use IEEE 754 and are not required to support negative zero.
Quoting the Scheme reports: "When in doubt, consult a numerical analyst."
The implementation approach of converting all arguments to inexact numbers if any argument is inexact is not transitive. For example, let big be (expt 2 1000), and assume that big is exact and that inexact numbers are represented by 64-bit IEEE binary floating point numbers. Then (= (- big 1) (inexact big)) and (= (inexact big) (+ big 1)) would both be true with this approach, because of the limitations of IEEE representations of large integers, whereas (= (- big 1) (+ big 1)) is false. Converting inexact values to exact numbers that are the same (in the sense of =) to them will avoid this problem, though special care must be taken with infinities.
(> 5 4) => #t
R2RS specified additional redundant names ending with ?, e.g., <=? in order to "make all user populations happy".
R2RS mentions that some implementations allowed many arguments like in Common Lisp, although Scheme before R2RS that ran on MacLISP also had predicates that worked like this. MacLISP's greaterp, and lessp accepted two or more arguments. On the other hand, MacLISP also had the procedures =, >, and < that only accepted two arguments and required that the arguments are both fixnums or both flonums.
LISP 1.5 had the subroutines equal, greaterp, and lessp. The first one was the same as kind of predicate as equal?(3scm) while the latter were subroutines of two arguments that compared numbers.