Arithmetic
a + b
Type of a
Type of b
Type of a + b
WITH TYPE PROMOTION
Fails with
"proto.alpha.tez.addition_overflow"
a + b value typed tez exceeds 9223372036854775807utza - b
Subtracts numbers.
Type of a
Type of b
Type of a - b
WITH TYPE PROMOTION
Fails with
"INVALID_NEGATIVE_TEZ"
a - b value typed tez is negative.- a
a.Fails with
does not fail
a * b
Multiplies two numbers
Type of a
Type of b
Type of a * b
WITH TYPE PROMOTION
Fails with
does not fail
a / b
Divides two numbers as a rational.
Fails with
does not fail
a div b
Returns the euclidean quotient of two a divided by b; a div b is equivalent to:
match a /% b with
| some(q,r) -> q
| none -> fail("DIV_BY_ZERO")
end
Fails with
"DIV_BY_ZERO"
b is equal to 0a % b
Returns the euclidean remainder of a divided by b (modulus); a % b is equivalent to:
match a /% b with
| some(q,r) -> r
| none -> fail("DIV_BY_ZERO")
end
Fails with
"DIV_BY_ZERO"
b is equal to 0a /% b
a by b; returns an option of quotient and remainder:some(q, r), whenbis different from 0,qbeing the quotient andrthe remaindernone, whenbis equal to 0
Fails with
does not fail
a <<| b
a to the left by the number of positions specified by b. Simultaneously, the empty spaces created by the bits shifted to the left are then filled with zeroes. It is a fast way to multiply by a power of 2.Fails with
"script_overflow"
b is greater than 256a |>> b
a to the right by the number of positions specified by b. It is a fast way to divide by a power of 2.Fails with
"script_overflow"
b is greater than 256a and b
trueifaandbaretruefalseotherwise- Bitwise
andof integers
Fails with
does not fail
a or b
trueifaorbistruefalseotherwise- Bitwise
orof naturals
Fails with
does not fail
a xor b
trueifaandbare differentfalseotherwise- Bitwise
xorof naturals
Fails with
does not fail
not a
trueifaisfalsefalseifaistrue- 2-complement if
ais a natural or an integer
Fails with
does not fail
a = b
Type of a
Type of b
Type of a = b
WITH TYPE PROMOTION
Fails with
does not fail
a <> b
not (a = b).Type of a
Type of b
Type of a <> b
WITH TYPE PROMOTION
Fails with
does not fail
a < b
Type of a
Type of b
Type of a < b
WITH TYPE PROMOTION
Fails with
does not fail
a <= b
Type of a
Type of b
Type of a <= b
WITH TYPE PROMOTION
Fails with
does not fail
a > b
Type of a
Type of b
Type of a > b
WITH TYPE PROMOTION
Fails with
does not fail
a >= b
Type of a
Type of b
Type of a >= b
WITH TYPE PROMOTION
Fails with
does not fail
a <=> b
-1whena < b1whena > b0whena = b
Type of a
Type of b
Type of a <=> b
WITH TYPE PROMOTION
Fails with
does not fail
a < b < c
Double inequality operators are syntactic shortcuts for logical conjonction of two comparisons:
Equivalence
a < b < ca < b and b < ca <= b < ca ≤ b and b < ca < b <= ca < b and b ≤ ca <= b <= ca ≤ b and b ≤ c