File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -36,13 +36,17 @@ fn main() {
3636 assert!(a == a); // 20 == 20 is true
3737 assert!(a != b); // 20 != 6 is true
3838
39- // Less than / greater than
39+ // Less than: u8 < u8 → bool
4040 assert!(b < a); // 6 < 20
41+
42+ // Greater than: u8 > u8 → bool
4143 assert!(a > b); // 20 > 6
4244
43- // Less or equal / greater or equal
45+ // Less or equal: u8 <= u8 → bool
4446 assert!(b <= a); // 6 <= 20
4547 assert!(b <= b); // 6 <= 6
48+
49+ // Greater or equal: u8 >= u8 → bool
4650 assert!(a >= b); // 20 >= 6
4751 assert!(a >= a); // 20 >= 20
4852}
Original file line number Diff line number Diff line change @@ -1077,7 +1077,8 @@ fn peek_single_expression_type(
10771077
10781078/// Maps a comparison infix operator and operand type to:
10791079/// - the Simplicity jet
1080- /// - whether arguments should be swapped (for `>` and `>=`)
1080+ /// - whether arguments should be swapped (for `>` and `>=`) Note: there are no GreaterThan jets, so the
1081+ /// args must be swapped.
10811082/// - whether the result should be negated (for `!=`)
10821083///
10831084/// Returns `Err` if there is no jet for the given combination.
@@ -1422,7 +1423,7 @@ impl AbstractSyntaxTree for SingleExpression {
14221423 lhs_warnings,
14231424 )
14241425 }
1425- _ => {
1426+ Add | Sub | Mul | Div | Rem => {
14261427 // Arithmetic operators
14271428 let ( jet, arg_ty, assert_no_carry) =
14281429 determine_infix_arith_op_jet ( binary. op ( ) , ty) . with_span ( from) ?;
Original file line number Diff line number Diff line change @@ -224,7 +224,7 @@ impl<'brand> Scope<'brand> {
224224
225225/// Returns the equality jet and a zero `simplicity::Value` for the operand type
226226/// of a divide or modulo jet. Used to generate the divisor-zero check.
227- fn divisor_check_jet_and_zero ( jet : Elements ) -> ( Elements , simplicity:: Value ) {
227+ fn divisor_check_jet_and_zero_for_binary_op ( jet : Elements ) -> ( Elements , simplicity:: Value ) {
228228 match jet {
229229 Elements :: Divide8 | Elements :: Modulo8 => ( Elements :: Eq8 , simplicity:: Value :: u8 ( 0 ) ) ,
230230 Elements :: Divide16 | Elements :: Modulo16 => ( Elements :: Eq16 , simplicity:: Value :: u16 ( 0 ) ) ,
@@ -390,7 +390,7 @@ impl SingleExpression {
390390 //
391391 // Step 1: check_rhs_eq_zero : (lhs, rhs) → (1+1)
392392 // = pair(drop(iden), unit_scribe(0)) >>> EqN
393- let ( eq_jet_elem, zero_sv) = divisor_check_jet_and_zero ( * jet) ;
393+ let ( eq_jet_elem, zero_sv) = divisor_check_jet_and_zero_for_binary_op ( * jet) ;
394394 // drop(iden) : (lhs, rhs) → rhs
395395 let rhs_from_pair = ProgNode :: drop_ ( & ProgNode :: iden ( scope. ctx ( ) ) ) ;
396396 // unit_scribe(0) : (lhs, rhs) → 0
You can’t perform that action at this time.
0 commit comments