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
Packages
ceylon.whole

Arbitrary precision integer arithmetic. T

Dependencies
ceylon.interop.java (jvm)1.2.2
java.base (jvm)8

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().

Values
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.

Functions
formatWholeSource Codeshared String formatWhole(Whole whole, Integer radix = ...)
Parameters:
  • whole
    • is WholeImpl whole
  • radix = 10
    • minRadix <= radix <= maxRadix
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.

Parameters:
  • string

    The string representation to parse.

  • radix = 10

    The base, between minRadix and maxRadix inclusive.

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

The given number converted to a Whole.

Throws
Interfaces
WholeSource Codeshared Whole

An arbitrary precision integer.