BigInt
Definitions
def
abs
(
x :
BigInt
)
: BigInt
\ Pure
Returns the absolute value of x
.
def
bitwiseAnd
(
x :
BigInt
y :
BigInt
)
: BigInt
\ Pure
Returns the bitwise AND of x
and y
.
def
bitwiseNot
(
x :
BigInt
)
: BigInt
\ Pure
Returns the bitwise NOT of x
.
def
bitwiseOr
(
x :
BigInt
y :
BigInt
)
: BigInt
\ Pure
Returns the bitwise OR of x
and y
.
def
bitwiseXor
(
x :
BigInt
y :
BigInt
)
: BigInt
\ Pure
Returns the bitwise XOR of x
and y
.
def
clampToFloat32
(
x :
BigInt
minimum :
Float32
maximum :
Float32
)
: Float32
\ Pure
Convert x
to a Float32
.
Returns x
clamped within the Float32 range minimum
to maximum
.
def
clampToFloat64
(
x :
BigInt
minimum :
Float64
maximum :
Float64
)
: Float64
\ Pure
Convert x
to a Float64
.
Returns x
clamped within the Float64 range minimum
to maximum
.
def
clampToInt16
(
x :
BigInt
minimum :
Int16
maximum :
Int16
)
: Int16
\ Pure
Convert x
to an Int16
.
Returns x
clamped within the Int16 range minimum
to maximum
.
def
clampToInt32
(
x :
BigInt
minimum :
Int32
maximum :
Int32
)
: Int32
\ Pure
Convert x
to an Int32
.
Returns x
clamped within the Int32 range minimum
to maximum
.
def
clampToInt64
(
x :
BigInt
minimum :
Int64
maximum :
Int64
)
: Int64
\ Pure
Convert x
to an Int64
.
Returns x
clamped within the Int64 range minimum
to maximum
.
def
clampToInt8
(
x :
BigInt
minimum :
Int8
maximum :
Int8
)
: Int8
\ Pure
Convert x
to an Int8
.
Returns x
clamped within the Int8 range minimum
to maximum
.
def
clearBit
(
x :
BigInt
position :
Int32
)
: BigInt
\ Pure
Returns x
with the bit at position position
cleared (to 0).
def
compare
(
x :
BigInt
y :
BigInt
)
: Int32
\ Pure
Returns 1
if x > y
, -1
if x < y
, and 0
if x = y
.
def
dist
(
x :
BigInt
y :
BigInt
)
: BigInt
\ Pure
Returns the distance between x
and y
.
def
flipBit
(
x :
BigInt
position :
Int32
)
: BigInt
\ Pure
Returns x
with the bit at position position
flipped.
def
fromString
(
s :
String
)
: Option[BigInt]
\ Pure
Parse the string s
as an BigInt, leading or trailing whitespace is trimmed.
A successful parse is wrapped with Some(x)
, a parse failure is indicated by None
.
def
gcd
(
x :
BigInt
y :
BigInt
)
: BigInt
\ Pure
Returns the greatest common non-negative divisor of x
and y
.
def
getBit
(
x :
BigInt
position :
Int32
)
: Int32
\ Pure
Returns the bit of x
at position
(either 0 or 1).
The bits of x have positions: 0 (rightmost bit), 1, 2, ...
def
leftShift
(
x :
BigInt
y :
Int32
)
: BigInt
\ Pure
Returns x
with the bits shifted left by y
places
def
log2
(
x :
BigInt
)
: Int32
\ Pure
Returns the integer binary logarithm of x
.
def
max
(
x :
BigInt
y :
BigInt
)
: BigInt
\ Pure
Returns the larger of x
and y
.
def
min
(
x :
BigInt
y :
BigInt
)
: BigInt
\ Pure
Returns the smaller of x
and y
.
def
mod
(
x :
BigInt
n :
BigInt
)
: BigInt
\ Pure
Returns the Euclidean modulo of x
and n
.
The result is always non-negative.
def
pow
(
x :
BigInt
n :
Int32
)
: BigInt
\ Pure
Returns x
raised to the power of n
.
def
rem
(
x :
BigInt
n :
BigInt
)
: BigInt
\ Pure
Returns the remainder of x / n
.
The result can be negative.
See also BigInt.mod
.
def
rightShift
(
x :
BigInt
y :
Int32
)
: BigInt
\ Pure
Returns x
with the bits shifted right by y
places
def
setBit
(
x :
BigInt
position :
Int32
)
: BigInt
\ Pure
Returns x
with the bit at position position
set (to 1).
def
signum
(
x :
BigInt
)
: Int32
\ Pure
Returns 1
if x > 0
, -1
if x < 0
, and 0
if x = 0
.
def
toBigDecimal
(
x :
BigInt
)
: BigDecimal
\ Pure
Convert x
to an BigDecimal
.
def
toString
(
x :
BigInt
)
: String
\ Pure
Return a string representation of x
.
def
tryToFloat32
(
x :
BigInt
)
: Option[Float32]
\ Pure
Convert x
to an Option[Float32]
.
Returns Some(x as Float32)
if the numeric value of x
is within the range of Float32.
Warning: even if x
is in the range of Float32 it may lose precision.
Returns None
if the numeric value of x
is outside the range of Float32
(i.e. 1.4E-45 to 3.4028235E38).
def
tryToFloat64
(
x :
BigInt
)
: Option[Float64]
\ Pure
Convert x
to an Option[Float64]
.
Returns Some(x as Float64)
if the numeric value of x
is within the range of Float32.
Warning: even if x
is in the range of Float64 it may lose precision.
Returns None
if the numeric value of x
is outside the range of Float64
(i.e 4.9E-324 to 1.7976931348623157E308).
def
tryToInt16
(
x :
BigInt
)
: Option[Int16]
\ Pure
Convert 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 :
BigInt
)
: Option[Int32]
\ Pure
Convert 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
tryToInt64
(
x :
BigInt
)
: Option[Int64]
\ Pure
Convert x
to an Option[Int64]
.
Returns Some(x as Int64)
if the numeric value of x
can be represented exactly.
Returns None
if the numeric value of x
is outside the range of Int64
(i.e. -9223372036854775808 to 9223372036854775807).
def
tryToInt8
(
x :
BigInt
)
: Option[Int8]
\ Pure
Convert 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).