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 9223372036854775807utz
a - 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)
, whenb
is different from 0,q
being the quotient andr
the remaindernone
, whenb
is 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 256
a |>> 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 256
a and b
true
ifa
andb
aretrue
false
otherwise- Bitwise
and
of integers
Fails with
does not fail
a or b
true
ifa
orb
istrue
false
otherwise- Bitwise
or
of naturals
Fails with
does not fail
a xor b
true
ifa
andb
are differentfalse
otherwise- Bitwise
xor
of naturals
Fails with
does not fail
not a
true
ifa
isfalse
false
ifa
istrue
- 2-complement if
a
is 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
-1
whena < b
1
whena > b
0
whena = 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 < c
a < b and b < c
a <= b < c
a ≤ b and b < c
a < b <= c
a < b and b ≤ c
a <= b <= c
a ≤ b and b ≤ c