Int64
Definitions
def abs(x: Int64): Int64
SourceReturns the absolute value of x
.
If the absolute value exceeds maxValue(), -1 is returned.
def bitCount(x: Int64): Int32
SourceReturns the number of one-bits in the two's complement binary
representation of x
.
def clampToInt16(min: { min = Int16 }, max: { max = Int16 }, x: Int64): Int16
SourceConvert x
to an Int16
.
Returns x
clamped within the Int16 range min
to max
.
def clampToInt32(min: { min = Int32 }, max: { max = Int32 }, x: Int64): Int32
SourceConvert x
to an Int32
.
Returns x
clamped within the Int32 range min
to max
.
def clampToInt8(min: { min = Int8 }, max: { max = Int8 }, x: Int64): Int8
SourceConvert x
to an Int8
.
Returns x
clamped within the Int8 range min
to max
.
def clearBit(pos: { pos = Int32 }, x: Int64): Int64
SourceReturns x
with the bit at position position
cleared (to 0).
Considers the 6 rightmost bits of position
(position
mod 64).
The bits of x have positions: 0 (rightmost bit) - 63 (leftmost bit)
def compare(x: Int64, y: Int64): Int32
SourceReturns 1 if x > y, -1 if x < y, and 0 if x = y. The sign of x - y.
def dist(x: Int64, y: Int64): Int64
SourceReturns the distance between x
and y
.
If this distance exceeds maxValue(), -1 is returned.
def factorial(x: Int64): Int64
SourceReturns the factorial of x
.
If the given value is negative, 0 is returned.
def flipBit(pos: { pos = Int32 }, x: Int64): Int64
SourceReturns x
with the bit at position position
flipped.
Considers the 6 rightmost bits of position
(position
mod 64).
The bits of x have positions: 0 (rightmost bit) - 63 (leftmost bit)
def fromString(s: String): Option[Int64]
SourceParse the string s
as an Int64, leading or trailing whitespace is trimmed.
A successful parse is wrapped with Some(x)
, a parse failure is indicated by None
.
def getBit(pos: { pos = Int32 }, x: Int64): Int32
SourceReturns the bit of x
at position
(either 0 or 1).
Considers the 6 rightmost bits of position
(position
mod 64).
The bits of x have positions: 0 (rightmost bit) - 63 (leftmost bit).
def highestOneBit(x: Int64): Int64
SourceReturns a value with at most a single one-bit, in the position
of the highest-order/leftmost one-bit in x
.
Returns 0 if x=0.
def highestOneBitPosition(x: Int64): Int32
SourceReturns the position of the highest-order/leftmost one-bit in x
.
Possible return values: 0 (rightmost bit) - 63 (leftmost bit)
-1 if x = 0
def log2(x: Int64): Int64
SourceReturns the integer binary logarithm of x
.
If the given value is 0 or negative, 0 is returned.
def logicalRightShift(dist: { dist = Int32 }, x: Int64): Int64
SourceReturns the logical right shift of x
by distance
.
Only the rightmost 6 bits of distance
are considered (ie. distance rem 64
).
A zero is shifted into the leftmost position regardless of sign extension.
def lowestOneBit(x: Int64): Int64
SourceReturns a value with at most a single one-bit, in the position
of the highest-order/leftmost one-bit in x
.
Returns 0 if x=0.
def lowestOneBitPosition(x: Int64): Int32
SourceReturns the position of the lowest-order/rightmost one-bit in x
.
Possible return values: 0 (rightmost bit) - 63 (leftmost bit)
-1 if x = 0
def mod(x: Int64, n: Int64): Int64
SourceReturns the Euclidean modulo of x
and n
.
The result is always non-negative.
def numberOfLeadingZeros(x: Int64): Int32
SourceReturns the number of zero bits preceding the
highest-order/leftmost one-bit in x
.
Returns 64 if x=0.
def numberOfTrailingZeros(x: Int64): Int32
SourceReturns the number of zero bits following the
lowest-order/rightmost one-bit in x
.
Returns 64 if x=0.
def parse(radix: Int32, s: String): Result[String, Int64]
SourceParse the string s
as an Int64, where the radix
is used while parsing.
Leading or trailing whitespace is trimmed.
A successful parse is wrapped with Ok(x)
, a parse failure is indicated by Err(_)
.
def rem(x: Int64, n: Int64): Int64
SourceReturns the remainder of x / n
.
The result can be negative.
See also Int64.mod
.
def reverse(x: Int64): Int64
SourceReturns the value obtained by reversing the bits in the
two's complement binary representation of x
.
def rotateLeft(dist: { dist = Int32 }, x: Int64): Int64
SourceReturns the the value obtained by rotating the two's complement
binary representation of x
left by distance
bits.
def rotateRight(dist: { dist = Int32 }, x: Int64): Int64
SourceReturns the the value obtained by rotating the two's complement
binary representation of x
right by distance
bits.
def setBit(pos: { pos = Int32 }, x: Int64): Int64
SourceReturns x
with the bit at position position
set (to 1).
Considers the 6 rightmost bits of position
(position
mod 64).
The bits of x have positions: 0 (rightmost bit) - 63 (leftmost bit)
def toBigDecimal(x: Int64): BigDecimal
SourceConvert x
to a BigDecimal.
Warning: The numeric value of x
may lose precision.
def toBigInt(x: Int64): BigInt
SourceConvert x
to a BigInt.
The numeric value of x
is preserved exactly.
def toFloat32(x: Int64): Float32
SourceConvert x
to a Float32.
Warning: The numeric value of x
may lose precision.
def toFloat64(x: Int64): Float64
SourceConvert x
to a Float64.
Warning: The numeric value of x
may lose precision.
def tryToInt16(x: Int64): Option[Int16]
SourceConvert x
to an Option[Int16]
.
Returns Some(x as Int16)
if the numeric value of x
can be represented exactly.
Returns None
if the numeric value of x
is outside the range of Int16
(i.e. -32768 to 32767).
def tryToInt32(x: Int64): Option[Int32]
SourceConvert x
to an Option[Int32]
.
Returns Some(x as Int32)
if the numeric value of x
can be represented exactly.
Returns None
if the numeric value of x
is outside the range of Int32
(i.e. -2147483648 to 2147483647).
def tryToInt8(x: Int64): Option[Int8]
SourceConvert x
to an Option[Int8]
.
Returns Some(x as Int8)
if the numeric value of x
can be represented exactly.
Returns None
if the numeric value of x
is outside the range of Int8
(i.e. -128 to 127).