flix

0.80.0

BigInt

Type of arbitrary-precision signed integers, and its functions.

Instances

Add, CommutativeGroup, CommutativeMonoid, CommutativeSemiGroup, Discrete, Div, Eq, Formattable, FromJson, FromString, Group, Hash, JoinLattice, MeetLattice, Monoid, Mul, Neg, Order, PartialOrder, SemiGroup, Sub, ToFlix, ToJava, ToJson, ToString

Definitions

def abs(x: BigInt): BigInt§ Source

Returns the absolute value of x.

def bitwiseAnd(x: BigInt, y: BigInt): BigInt§ Source

Returns the bitwise AND of x and y.

def bitwiseNot(x: BigInt): BigInt§ Source

Returns the bitwise NOT of x.

def bitwiseOr(x: BigInt, y: BigInt): BigInt§ Source

Returns the bitwise OR of x and y.

def bitwiseXor(x: BigInt, y: BigInt): BigInt§ Source

Returns the bitwise XOR of x and y.

def clampToFloat32(min: { min = Float32 }, max: { max = Float32 }, x: BigInt): Float32§ Source

Convert x to a Float32.

Returns x clamped within the Float32 range min to max.

def clampToFloat64(min: { min = Float64 }, max: { max = Float64 }, x: BigInt): Float64§ Source

Convert x to a Float64.

Returns x clamped within the Float64 range min to max.

def clampToInt16(min: { min = Int16 }, max: { max = Int16 }, x: BigInt): Int16§ Source

Convert x to an Int16.

Returns x clamped within the Int16 range min to max.

def clampToInt32(min: { min = Int32 }, max: { max = Int32 }, x: BigInt): Int32§ Source

Convert x to an Int32.

Returns x clamped within the Int32 range min to max.

def clampToInt64(min: { min = Int64 }, max: { max = Int64 }, x: BigInt): Int64§ Source

Convert x to an Int64.

Returns x clamped within the Int64 range min to max.

def clampToInt8(min: { min = Int8 }, max: { max = Int8 }, x: BigInt): Int8§ Source

Convert x to an Int8.

Returns x clamped within the Int8 range min to max.

def clearBit(x: BigInt, position: Int32): BigInt§ Source

Returns x with the bit at position position cleared (to 0).

def compare(x: BigInt, y: BigInt): Int32§ Source

Returns 1 if x > y, -1 if x < y, and 0 if x = y.

def dist(x: BigInt, y: BigInt): BigInt§ Source

Returns the distance between x and y.

def flipBit(x: BigInt, position: Int32): BigInt§ Source

Returns x with the bit at position position flipped.

def fromString(s: String): Option[BigInt]§ Source

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§ Source

Returns the greatest common non-negative divisor of x and y.

def getBit(x: BigInt, position: Int32): Int32§ Source

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§ Source

Returns x with the bits shifted left by y places

def log2(x: BigInt): Int32§ Source

Returns the integer binary logarithm of x.

def max(x: BigInt, y: BigInt): BigInt§ Source

Returns the larger of x and y.

def min(x: BigInt, y: BigInt): BigInt§ Source

Returns the smaller of x and y.

def modulo(x: BigInt, n: BigInt): BigInt§ Source

Returns the Euclidean modulo of x and n. The result is always non-negative.

def pow(base: { base = BigInt }, n: Int32): BigInt§ Source

Returns base raised to the power of n.

def remainder(x: BigInt, n: BigInt): BigInt§ Source

Returns the remainder of x / n. The result can be negative.

See also BigInt.modulo.

def rightShift(x: BigInt, y: Int32): BigInt§ Source

Returns x with the bits shifted right by y places

def setBit(x: BigInt, position: Int32): BigInt§ Source

Returns x with the bit at position position set (to 1).

def signum(x: BigInt): Int32§ Source

Returns 1 if x > 0, -1 if x < 0, and 0 if x = 0.

def toBigDecimal(x: BigInt): BigDecimal§ Source

Convert x to an BigDecimal.

def toString(x: BigInt): String§ Source

Return a string representation of x.

def tryToFloat32(x: BigInt): Option[Float32]§ Source

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]§ Source

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]§ Source

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]§ Source

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]§ Source

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]§ Source

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).