comparison operators
The operators listed below are available for all data types unless specified otherwise.
(‘a == ‘a) -> boolean, const autodiff
Returns true in case of equality.
Text values are compared by Unicode code unit.
show summary "" with
true == false as "on boolean"
1 == 2 as "on number"
"Hello" == "hello" as "on text"
date(2019,7,1) == date(2019,1,7) as "on date"
(i64 == i64) -> boolean, const
Returns true when the two values are equal. The operands are compared as i64 values,
without first rounding to number.
show scalar "Comparison" with to.i64(1) == to.i64(2) // false
(f64 == f64) -> boolean, const
Returns true when the two values are equal. The operands are compared as f64 values,
without first rounding to number.
show scalar "Comparison" with to.f64(1) == to.f64(2) // false
(‘a < ‘a) -> boolean, const autodiff
Returns true is the first value is strictly lower than the second one.
Ordering is not available for the ranvar, zedfunc, and embedding types.
Text values are sorted in alphabetical order, specifically, by Unicode code points.
Boolean values are ordered as false < true.
show summary "" with
false < true as "on boolean"
1 < 2 as "on number"
"Hello" < "hello" as "on text"
date(2019,7,1) < date(2019,1,7) as "on date"
(i64 < i64) -> boolean, const
Returns true when the first value is strictly lower than the second. The operands are compared as i64 values,
without first rounding to number.
show scalar "Comparison" with to.i64(1) < to.i64(2) // true
(f64 < f64) -> boolean, const
Returns true when the first value is strictly lower than the second. The operands are compared as f64 values,
without first rounding to number.
show scalar "Comparison" with to.f64(1) < to.f64(2) // true
(‘a != ‘a) -> boolean, const autodiff
The expression a != b is the same as not (a == b).
show summary "" with
true != false as "on boolean"
1 != 2 as "on number"
"Hello" != "hello" as "on text"
date(2019,7,1) != date(2019,1,7) as "on date"
(i64 != i64) -> boolean, const
Returns true when the two values differ. The operands are compared as i64 values,
without first rounding to number.
show scalar "Comparison" with to.i64(1) != to.i64(2) // true
(f64 != f64) -> boolean, const
Returns true when the two values differ. The operands are compared as f64 values,
without first rounding to number.
show scalar "Comparison" with to.f64(1) != to.f64(2) // true
(‘a > ‘a) -> boolean, const autodiff
The expression a > b is defined as not (a < b) and a != b.
show summary "" with
true > false as "on boolean"
1 > 2 as "on number"
"Hello" > "hello" as "on text"
date(2019,7,1) > date(2019,1,7) as "on date"
(i64 > i64) -> boolean, const
Returns true when the first value is strictly greater than the second. The operands are compared as i64 values,
without first rounding to number.
show scalar "Comparison" with to.i64(1) > to.i64(2) // false
(f64 > f64) -> boolean, const
Returns true when the first value is strictly greater than the second. The operands are compared as f64 values,
without first rounding to number.
show scalar "Comparison" with to.f64(1) > to.f64(2) // false
(‘a <= ‘a) -> boolean, const autodiff
The expression a <= b is defined as (a < b) or a == b.
show summary "" with
false <= true as "on boolean"
1 <= 2 as "on number"
"Hello" <= "hello" as "on text"
date(2019,7,1) <= date(2019,1,7) as "on date"
(i64 <= i64) -> boolean, const
Returns true when the first value is lower than or equal to the second. The operands are compared as i64 values,
without first rounding to number.
show scalar "Comparison" with to.i64(1) <= to.i64(2) // true
(f64 <= f64) -> boolean, const
Returns true when the first value is lower than or equal to the second. The operands are compared as f64 values,
without first rounding to number.
show scalar "Comparison" with to.f64(1) <= to.f64(2) // true
(‘a >= ‘a) -> boolean, const autodiff
The expression a >= b is defined as not (a < b).
show summary "" with
true >= false as "on boolean"
1 >= 2 as "on number"
"Hello" >= "hello" as "on text"
date(2019,7,1) >= date(2019,1,7) as "on date"
(i64 >= i64) -> boolean, const
Returns true when the first value is greater than or equal to the second. The operands are compared as i64 values,
without first rounding to number.
show scalar "Comparison" with to.i64(1) >= to.i64(2) // false
(f64 >= f64) -> boolean, const
Returns true when the first value is greater than or equal to the second. The operands are compared as f64 values,
without first rounding to number.
show scalar "Comparison" with to.f64(1) >= to.f64(2) // false