Numeric Comparisons(数值比较)
函数 =
是数值等价谓词。它用数学意义上的值来比较数字,而忽略类型上的区别。这样,=
将把不同类型在数学意义上等价的值视为等价,而通用等价谓词 EQL 将由于其类型差异而视其不等价。(但通用等价谓词 EQUALP 使用 =
来比较数字。)如果它以超过两个参数被调用,它将只有当所有参数具有相同值时才返回真。如下所示:
The /=
function, conversely, returns true only if all its arguments are different values.
The functions <
, >
, <=
, and >=
order rationals and floating-point numbers (in other words, the real numbers.) Like =
and , these functions can be called with more than two arguments, in which case each argument is compared to the argument to its right.
函数 <
、>
、<=
和 >=
检查有理数和浮点数(也就是实数)的次序。跟 =
和 相似,这些函数也可以用超过两个参数来调用,这时每个参数都跟其右边的那个参数相比较。
要想选出几个数字中最小或最大的那个,你可以使用函数 MIN 或 MAX,其接受任意数量的实数参数并返回最小或最大值。
Some other handy functions are ZEROP, MINUSP, and PLUSP, which test whether a single real number is equal to, less than, or greater than zero. Two other predicates, EVENP and ODDP, test whether a single integer argument is even or odd. The P
suffix on the names of these functions is a standard naming convention for predicate functions, functions that test some condition and return a boolean.