Attributes
evenSource Codeshared 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.

floatSource Codeshared 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, that is, if

    this.magnitude>runtime.maxExactIntegralFloat
    

    (Note that nearestFloat does not produce an exception in this case.)

integerSource Codeshared 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.

nearestFloatSource Codeshared formal Float nearestFloat

The nearest Float to this number.

  • For any number with Number.magnitude smaller than runtime.maxExactIntegralFloat (253), this is a Float with the exact same mathematical value (and the same value as float).
  • For large values, the Floats are less dense than the Wholes so there may be loss of precision.

This method never throws an OverflowException.

See also float
Since 1.3.2
notSource Codeshared 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<Other>
Attributes inherited from: Integral<Other>
Attributes inherited from: Invertible<Other>
Attributes inherited from: Number<Other>
Attributes inherited from: Ordinal<Other>
Methods
andSource Codeshared 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.

flipSource Codeshared 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.

getSource Codeshared formal Boolean get(Integer index)

Retrieves a given bit from the two's complement representation of this Whole if index <= 0, otherwise returns false.

leftLogicalShiftSource Codeshared 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.

moduloSource Codeshared formal Whole modulo(Whole modulus)

The result of this mod modulus, differing from Integral.remainder() in that the returned value will always be positive.

moduloInverseSource Codeshared formal Whole moduloInverse(Whole modulus)

The result of (this-1 mod m)

moduloPowerSource Codeshared formal Whole moduloPower(Whole exponent, Whole modulus)

The result of (this**exponent) mod modulus.

Throws
offsetSource Codeshared 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

orSource Codeshared 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.

powerSource Codeshared 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
powerRemainderSource Codeshared Whole powerRemainder(Whole exponent, Whole modulus)

Deprecated: Renamed to moduloPower().

Throws
See also moduloPower()
quotientAndRemainderSource Codeshared formal Whole[2] 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.

rightArithmeticShiftSource Codeshared 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.

setSource Codeshared 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
xorSource Codeshared 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
Methods inherited from: Comparable<Other>
Methods inherited from: Enumerable<Other>
Methods inherited from: Exponentiable<This,Other>
Methods inherited from: Integral<Other>
Methods inherited from: Invertible<Other>
Methods inherited from: Number<Other>
Methods inherited from: Numeric<Other>
Methods inherited from: Summable<Other>