Next: , Previous: , Up: ref-ari   [Contents][Index]


4.7.4 Arithmetic Comparison

Each of the following predicates evaluates each of its arguments as an arithmetic expression, then compares the results. If one argument evaluates to an integer and the other to a float, then the integer is coerced to a float before the comparison is made.

Note that two floating-point numbers are equal if and only if they have the same bit pattern. Because of rounding error, it is not normally useful to compare two floats for equality.

Expr1 =:= Expr2

succeeds if the results of evaluating terms Expr1 and Expr2 as arithmetic expressions are equal

Expr1 =\= Expr2

succeeds if the results of evaluating terms Expr1 and Expr2 as arithmetic expressions are not equal

Expr1 < Expr2

succeeds if the result of evaluating Expr1 as an arithmetic expression is less than the result of evaluating Expr2 as an arithmetic expression.

Expr1 > Expr2

succeeds if the result of evaluating Expr1 as an arithmetic expression Expr1 is greater than the result of evaluating Expr2 as an arithmetic expression.

Expr1 =< Expr2

succeeds if the result of evaluating Expr1 as an arithmetic expression is not greater than the result of evaluating Expr2 as an arithmetic expression.

Expr1 >= Expr2

succeeds if the result of evaluating Expr1 as an arithmetic expression is not less than the result of evaluating Expr2 as an arithmetic expression.



Send feedback on this subject.