An arbitrary precision integer.

By: John Vasileff

no type hierarchy

• `Whole`
• `Exponentiable`
• `Numeric`
• `Invertible`
• `Summable`
• `Integral`
• `Enumerable`
• `Ordinal`
• `Number`
• `Comparable`
• `Numeric`
• `Invertible`
• `Summable`

no subtypes hierarchy

 Attributes `even` Source Code`shared formal Boolean even`Determine if this number is even. A number `i` is even if there exists an integer `k` such that: ```i == 2*k ``` Thus, `i` is even if and only if `i%2 == 0`. `float` Source Code`shared formal Float float`The number, represented as a `Float`, if such a representation is possible. Throws `OverflowException`if the number cannot be represented as a `Float` without loss of precision `integer` Source Code`shared formal Integer integer`The number, as an `Integer` composed of the `runtime.integerAddressableSize` number of least significant bits of the two's complement representation of this Whole. The sign of the returned `Integer` may be different from the sign of the Whole. `not` Source Code`shared formal Whole not`The binary complement of this sequence of bits. The returned value will have the opposite sign of the orignal value.
 Inherited Attributes Attributes inherited from: `Object` Attributes inherited from: `Enumerable` Attributes inherited from: `Integral` Attributes inherited from: `Invertible``negated` Attributes inherited from: `Number` Attributes inherited from: `Ordinal`
 Methods `and` Source Code`shared formal Whole and(Whole other)`Performs a logical AND operation. The result will be negative if and only if both this and the other `Whole` is negative. `flip` Source Code`shared formal Whole flip(Integer index)`Returns an instance with the given bit flipped to its opposite value if `index >= 0`, otherwise returns a value with the same bits as this value. `get` Source Code`shared formal Boolean get(Integer index)`Retrieves a given bit from the two's complement representation of this Whole if `index <= 0`, otherwise returns false. `leftLogicalShift` Source Code`shared formal Whole leftLogicalShift(Integer shift)`Shift the sequence of bits to the left, by the given number of places, filling the least significant bits with zeroes. `modulo` Source Code`shared formal Whole modulo(Whole modulus)`The result of `this mod modulus`, differing from `Integral.remainder()` in that the returned value will always be positive. Refines `Integral.modulo` `moduloInverse` Source Code`shared formal Whole moduloInverse(Whole modulus)`The result of (this-1 mod m) `moduloPower` Source Code`shared formal Whole moduloPower(Whole exponent, Whole modulus)`The result of `(this**exponent) mod modulus`. Throws `Exception`If passed a negative modulus `offset` Source Code`shared formal Integer offset(Whole other)`The distance between this whole and the other whole Throws `OverflowException`The numbers differ by an amount larger than can be represented as an `Integer` Refines `Enumerable.offset` `or` Source Code`shared formal Whole or(Whole other)`Performs a logical OR operation. The result will be negative if and only if either this or the other `Whole` is negative. `power` Source Code`shared formal Whole power(Whole exponent)`The result of raising this number to the given power. Special cases: Returns one if `this` is one (or all powers) Returns one if `this` is minus one and the power is even Returns minus one if `this` is minus one and the power is odd Returns one if the power is zero. Otherwise negative powers result in an `Exception` being thrown Throws `Exception`If passed a negative exponent `OverflowException`If passed an exponent > runtime.maxIntegerValue `powerRemainder` Source Code`shared Whole powerRemainder(Whole exponent, Whole modulus)`Deprecated: Renamed to `moduloPower()`. Throws `Exception`If passed a negative modulus See also `moduloPower()` `quotientAndRemainder` Source Code`shared formal WholeGo to Tuple abbreviation [X,Y] means Tuple> quotientAndRemainder(Whole other)`Returns a pair containing the same results as calling `divided()` and `remainder()` with the given argument, except the division is only performed once. `rightArithmeticShift` Source Code`shared formal Whole rightArithmeticShift(Integer shift)`Shift the sequence of bits to the right, by the given number of places, preserving the values of the most significant bits. If the sequence of bits represents a signed value, the sign is preserved. `set` Source Code`shared formal Whole set(Integer index, Boolean bit = true)`Returns an instance with the given bit set to the given value if `index >= 0`, otherwise returns a value with the same bits as this value. Parameters: `bit = true` `xor` Source Code`shared formal Whole xor(Whole other)`Performs a logical XOR operation. The result will be negative if and only if exactly one of this and the other `Whole` is negative.
 Inherited Methods Methods inherited from: `Object``equals()` Methods inherited from: `Comparable` Methods inherited from: `Enumerable` Methods inherited from: `Exponentiable``power()` Methods inherited from: `Integral` Methods inherited from: `Invertible``minus()` Methods inherited from: `Number` Methods inherited from: `Numeric` Methods inherited from: `Summable``plus()`