BigInt class
An arbitrarily large integer.
- Implemented types
Constructors
- BigInt.from(num value) factory
- Allocates a big integer from the provided
valuenumber.
Properties
- bitLength → int read-only
- Returns the minimum number of bits required to store this big integer. [...]
- hashCode → int read-only, inherited
- The hash code for this object. [...]
- isEven → bool read-only
- Whether this big integer is even.
- isNegative → bool read-only
- Whether this number is negative.
- isOdd → bool read-only
- Whether this big integer is odd.
- isValidInt → bool read-only
- Whether this big integer can be represented as an
intwithout losing precision. [...] - runtimeType → Type read-only, inherited
- A representation of the runtime type of the object.
- sign → int read-only
- Returns the sign of this big integer. [...]
Methods
- abs(
) → BigInt - Returns the absolute value of this integer. [...]
- compareTo(
BigInt other) → int override - Compares this to
other. [...] - 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
exponentmodulomodulus. [...] - noSuchMethod(
Invocation invocation) → dynamic inherited - Invoked when a non-existent method or property is accessed. [...]
- pow(
int exponent) → BigInt - Returns
thisto the power ofexponent. [...] - remainder(
BigInt other) → BigInt - Returns the remainder of the truncating division of
thisbyother. [...] - 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
widthbits of this integer, extending the highest retained bit to the sign. This is the same as truncating the value to fit inwidthbits using an signed 2-s complement representation. The returned value has the same bit value in all positions higher thanwidth. [...] - toString(
) → String override - Returns a String-representation of this integer. [...]
- toUnsigned(
int width) → BigInt - Returns the least significant
widthbits 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 - Multiplication operator.
- operator +(
BigInt other) → BigInt - Addition operator.
- operator -(
BigInt other) → BigInt - Subtraction operator.
- operator /(
BigInt other) → double - Division operator.
- operator <(
BigInt other) → bool - Relational less than operator.
- operator <<(
int shiftAmount) → BigInt - Shift the bits of this integer to the left by
shiftAmount. [...] - operator <=(
BigInt other) → bool - Relational less than or equal operator.
- operator ==(
Object other) → bool inherited - The equality operator. [...]
- operator >(
BigInt other) → bool - Relational greater than operator.
- operator >=(
BigInt other) → bool - Relational greater than or equal operator.
- 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 division operator. [...]
Static Properties
Static Methods
- parse(
String source, {int? radix}) → BigInt - Parses
sourceas a, possibly signed, integer literal and returns its value. [...] - tryParse(
String source, {int? radix}) → BigInt? - Parses
sourceas a, possibly signed, integer literal and returns its value. [...]
© 2012 the Dart project authors
Licensed under the Creative Commons Attribution-ShareAlike License v4.0.
https://api.dart.dev/stable/2.13.0/dart-core/BigInt-class.html