Warning: This is the manual of the legacy Guile 2.2 series. You may want to read the manual of the current stable series instead.

Next: , Previous: , Up: Numbers   [Contents][Index]


6.6.2.8 Comparison Predicates

The C comparison functions below always takes two arguments, while the Scheme functions can take an arbitrary number. Also keep in mind that the C functions return one of the Scheme boolean values SCM_BOOL_T or SCM_BOOL_F which are both true as far as C is concerned. Thus, always write scm_is_true (scm_num_eq_p (x, y)) when testing the two Scheme numbers x and y for equality, for example.

Scheme Procedure: =
C Function: scm_num_eq_p (x, y)

Return #t if all parameters are numerically equal.

Scheme Procedure: <
C Function: scm_less_p (x, y)

Return #t if the list of parameters is monotonically increasing.

Scheme Procedure: >
C Function: scm_gr_p (x, y)

Return #t if the list of parameters is monotonically decreasing.

Scheme Procedure: <=
C Function: scm_leq_p (x, y)

Return #t if the list of parameters is monotonically non-decreasing.

Scheme Procedure: >=
C Function: scm_geq_p (x, y)

Return #t if the list of parameters is monotonically non-increasing.

Scheme Procedure: zero? z
C Function: scm_zero_p (z)

Return #t if z is an exact or inexact number equal to zero.

Scheme Procedure: positive? x
C Function: scm_positive_p (x)

Return #t if x is an exact or inexact number greater than zero.

Scheme Procedure: negative? x
C Function: scm_negative_p (x)

Return #t if x is an exact or inexact number less than zero.