Source Code

This module provides an arbitrary-precision integer numeric type.

The type Whole is a first-class numeric type and support all the usual mathematical operations:

Whole i = wholeNumber(12P);
Whole j = wholeNumber(3);
Whole n = i**j + j;
print(n); //prints 1728000000000000000000000000000000000003
By: Tom Bentley, John Vasileff

Arbitrary precision integer arithmetic. T

java.base (jvm)7

Arbitrary precision integer arithmetic. The focus of this package is the Whole type which performs calculations using arbitrary precision integer arithmetic. An instance of Whole may be obtained by calling wholeNumber() or parseWhole().

oneSource Codeshared Whole one

A Whole instance representing one.

twoSource Codeshared Whole two

A Whole instance representing two.

zeroSource Codeshared Whole zero

A Whole instance representing zero.

formatWholeSource Codeshared String formatWhole(Whole whole, Integer radix = ..., Character? groupingSeparator = null)
  • whole

    The number value to format.

    • is WholeImpl whole
  • radix = 10

    The base, between 2 and 36 inclusive.

    • minRadix <= radix <= maxRadix
  • groupingSeparator = null

    If not null, groupingSeparator will be used to separate each group of three digits if radix is 10, or each group of four digits if radix is 2 or 16.

    groupingSeparator may not be '-', a digit as defined by the Unicode general category Nd, or a letter as defined by the Unicode general categories Lu, Ll, Lt, Lm, and Lo.

gcdSource Codeshared Whole gcd(Whole first, Whole second)

The greatest common divisor.

parseWholeSource Codeshared Whole? parseWhole(String string, Integer radix = ...)

The Whole represented by the given string, or null if the given string does not represent a Whole.

  • string

    The string representation to parse.

  • radix = 10

    The base, between minRadix and maxRadix inclusive.

    • minRadix <= radix <= maxRadix
See also formatWhole()
wholeNumberSource Codeshared Whole wholeNumber(Integer number)

The given number converted to a Whole.

WholeSource Codeshared Whole

An arbitrary precision integer.