Euclidean-0 modulus. See (/):(x : int64std/core/types/int64: V, y : int64std/core/types/int64: V) -> int64std/core/types/int64: V
division for more information.
Multiply two 64-bit integers.
Euclidean-0 division.
Euclidean division is defined as: For any D
and d
where d!=0
, we have:
D == d*(D/d) + (D%d)
D%d
is always positive where 0 <= D%d < abs(d)
Moreover, Euclidean-0 is a total function, for the case where d==0
we have
that D%0 == D
and D/0 == 0
. So property (1) still holds, but not property (2).
Useful laws that hold for Euclidean-0 division:
D/(-d) == -(D/d)
D%(-d) == D%d
D/(2^n) == sarstd/num/int64/sar: (i : int64, shift : int) -> int64(D,n)
(with 0 <= n <= 31
)
D%(2n) == D & ((2n) - 1)
(with 0 <= n <= 31
)
Note that an interesting edge case is min-int64std/num/int64/min-int64: int64 / -1
which equals min-int64std/num/int64/min-int64: int64
since in modulo 64-bit
arithmetic min-int64std/num/int64/min-int64: int64 == -1 * min-int64std/num/int64/min-int64: int64 == -1 * (min-int64std/num/int64/min-int64: int64 / -1) + (min-int64std/num/int64/min-int64: int64 % -1)
satisfying property (1).
Of course (min-int64std/num/int64/min-int64: int64 + 1) / -1
is again positive (namely max-int64std/num/int64/max-int64: int64
).
See also Division and modulus for computer scientists, Daan Leijen, 2001 pdf .
Take the bitwise xor of two int64std/core/types/int64: V
s.
Negate an 64-bit integer.
Return the absolute value of an integer.
Raises an exception if the int64std/core/types/int64: V
is min-int64std/num/int64/min-int64: int64
(since the negation of min-int64std/num/int64/min-int64: int64
equals itself and is still negative).
Return the absolute value of an integer.
Returns 0 if the int64std/core/types/int64: V
is min-int64std/num/int64/min-int64: int64
(since the negation of min-int64std/num/int64/min-int64: int64
equals itself and is still negative).
Take the bitwise and of two int64std/core/types/int64: V
s.
The number of bits in an int64std/core/types/int64: V
(always 64).
Convert an int64std/core/types/int64: V
to a boolean.
Truncated division (as in C). See also (/):(x : int64std/core/types/int64: V, y : int64std/core/types/int64: V) -> int64std/core/types/int64: V
.
Truncated modulus (as in C). See also (%):(x : int64std/core/types/int64: V, y : int64std/core/types/int64: V) -> int64std/core/types/int64: V
.
Decrement a 64-bit integer.
Convert an 64-bit integer to a float64std/core/types/float64: V
.
Increment a 64-bit integer.
Clamp an int64std/core/types/int64: V
to an int32std/core/types/int32: V
-1.int64.int32 == -1.int32
0x8000_0000.int64.int32 == 0x7FFF_FFFF.int32
(clamped).
Convert an int32std/core/types/int32: V
to an int64std/core/types/int64: V
(using sign extension).
Convert a boolean to an int64std/core/types/int64: V
.
Create an int64std/core/types/int64: V
i
from the bits of lo
and hi
such
that i.int = hi.int * 0x1_0000_0000 + lo.uint
.
Returns true
if the integer i
is an even number.
Returns true
if the integer i
is an odd number.
Return the maximum of two integers.
The maximal integer value before overflow happens.
Return the minimum of two integers.
The minimal integer value before underflow happens.
Negate a 64-bit integer.
Bitwise not of an int64std/core/types/int64: V
, i.e. flips all bits.
Take the bitwise or of two int64std/core/types/int64: V
s.
Bitwise rotate an int64std/core/types/int64: V
n % 64
bits to the left.
Bitwise rotate an int64std/core/types/int64: V
n % 64
bits to the right.
Arithmetic shift an int64std/core/types/int64: V
to the right by n % 64
bits. Shift in the sign bit from the left.
Shift an int64std/core/types/int64: V
i
to the left by n % 64
bits.
Convert an int64std/core/types/int64: V
to a string.
Show an int64std/core/types/int64: V
in hexadecimal notation
The width
parameter specifies how wide the hex value is where '0'
is used to align.
The use-capitals
parameter (= Truestd/core/types/True: bool
) determines if captical letters should be used to display the hexadecimal digits.
The pre
(="0x"
) is an optional prefix for the number (goes between the sign and the number).
Show an int64std/core/types/int64: V
in hexadecimal notation interpreted as an unsigned 64-bit value.
The width
parameter specifies how wide the hex value is where '0'
is used to align.
The use-capitals
parameter (= Truestd/core/types/True: bool
) determines if captical letters should be used to display the hexadecimal digits.
The pre
(="0x"
) is an optional prefix for the number.
Logical shift an int64std/core/types/int64: V
to the right by n % 64
bits. Shift in zeros from the left.
Convert an int64std/core/types/int64: V
to an intstd/core/types/int: V
but interpret the int64std/core/types/int64: V
as a 64-bit unsigned value.
Clamp an int64std/core/types/int64: V
to an int32std/core/types/int32: V
but interpreting the int32std/core/types/int32: V
as unsigned
(and thus clamp between 0 and 0xFFFFFFFF).
-1.int64.uint32std/num/int64/uint32: (i : int64) -> int32 == 0.int32
(clamped)
0xFFFFFFFF.int64.uint32std/num/int64/uint32: (i : int64) -> int32 == -1.int32
.
Convert an int32std/core/types/int32: V
to an int64std/core/types/int64: V
interpreting the int32std/core/types/int32: V
as unsigned.
Convert an intstd/core/types/int: V
to int64std/core/types/int64: V
but interpret the int
as an unsigned 64-bit value.
i
is clamped between 0
and 0xFFFF_FFFF_FFFF_FFFF
.
0x7FFF_FFFF_FFFF_FFFF.uint64 == 0x7FFF_FFFF_FFFF_FFFF.int64 == max-int64std/num/int64/max-int64: int64
0x8000_0000_0000_0000.uint64 == -0x8000_0000_0000_0000.int64 == min-int64std/num/int64/min-int64: int64
0xFFFF_FFFF_FFFF_FFFF.uint64 == -1.int64
.
Take the bitwise xor of two int64std/core/types/int64: V
s.
64-bit signed integers.
Using 64-bit signed two's complement representation with wrapping on overflow, e.g.
max-int64std/num/int64/max-int64: int64 + 1.int64 == min-int64std/num/int64/min-int64: int64
.