BigInt class Null safety
An arbitrarily large integer value.
Big integers are signed and can have an arbitrary number of significant digits, only limited by memory.
- Implemented types
Constructors
- BigInt.from(num value)
-
Allocates a big integer from the provided
value
number.factory
Properties
- bitLength → int
-
Returns the minimum number of bits required to store this big integer. [...]
read-only
- hashCode → int
-
The hash code for this object. [...]
read-only, inherited
- isEven → bool
-
Whether this big integer is even.
read-only
- isNegative → bool
-
Whether this number is negative.
read-only
- isOdd → bool
-
Whether this big integer is odd.
read-only
- isValidInt → bool
-
Whether this big integer can be represented as an
int
without losing precision. [...]read-only - runtimeType → Type
-
A representation of the runtime type of the object.
read-only, inherited
- sign → int
-
Returns the sign of this big integer. [...]
read-only
Methods
-
abs(
) → BigInt - Returns the absolute value of this integer. [...]
-
compareTo(
BigInt other) → int -
Compares this to
other
. [...]override -
gcd(
BigInt other) → BigInt -
Returns the greatest common divisor of this big integer and
other
. [...] -
modInverse(
BigInt modulus) → BigInt -
Returns the modular multiplicative inverse of this big integer
modulo
modulus
. [...] -
modPow(
BigInt exponent, BigInt modulus) → BigInt -
Returns this integer to the power of
exponent
modulomodulus
. [...] -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a non-existent method or property is accessed. [...]
inherited
-
pow(
int exponent) → BigInt -
Returns
this
to the power ofexponent
. [...] -
remainder(
BigInt other) → BigInt -
Returns the remainder of the truncating division of
this
byother
. [...] -
toDouble(
) → double - Returns this BigInt as a double. [...]
-
toInt(
) → int - Returns this BigInt as an int. [...]
-
toRadixString(
int radix) → String -
Converts this to a string representation in the given
radix
. [...] -
toSigned(
int width) → BigInt -
Returns the least significant
width
bits of this integer, extending the highest retained bit to the sign. This is the same as truncating the value to fit inwidth
bits using an signed 2-s complement representation. The returned value has the same bit value in all positions higher thanwidth
. [...] -
toString(
) → String -
Returns a String-representation of this integer. [...]
override
-
toUnsigned(
int width) → BigInt -
Returns the least significant
width
bits of this big integer as a non-negative number (i.e. unsigned representation). The returned value has zeros in all bit positions higher thanwidth
. [...]
Operators
-
operator %(
BigInt other) → BigInt - Euclidean modulo operator. [...]
-
operator &(
BigInt other) → BigInt - Bit-wise and operator. [...]
-
operator *(
BigInt other) → BigInt -
Multiplies
other
by this big integer. [...] -
operator +(
BigInt other) → BigInt -
Adds
other
to this big integer. [...] -
operator -(
BigInt other) → BigInt -
Subtracts
other
from this big integer. [...] -
operator /(
BigInt other) → double - Double division operator. [...]
-
operator <(
BigInt other) → bool -
Whether this big integer is numerically smaller than
other
. -
operator <<(
int shiftAmount) → BigInt -
Shift the bits of this integer to the left by
shiftAmount
. [...] -
operator <=(
BigInt other) → bool -
Whether
other
is numerically greater than this big integer. -
operator ==(
Object other) → bool -
The equality operator. [...]
inherited
-
operator >(
BigInt other) → bool -
Whether this big integer is numerically greater than
other
. -
operator >=(
BigInt other) → bool -
Whether
other
is numerically smaller than this big integer. -
operator >>(
int shiftAmount) → BigInt -
Shift the bits of this integer to the right by
shiftAmount
. [...] -
operator ^(
BigInt other) → BigInt - Bit-wise exclusive-or operator. [...]
-
operator unary-(
) → BigInt - Return the negative value of this integer. [...]
-
operator |(
BigInt other) → BigInt - Bit-wise or operator. [...]
-
operator ~(
) → BigInt - The bit-wise negate operator. [...]
-
operator ~/(
BigInt other) → BigInt - Truncating integer division operator. [...]