Main Overview

Class NumeralSystem

Class NumeralSystem: Numeral Systems
This is a static class (only static methods available).

Overview:

Class methods (static methods)

MethodMeaning
binary (n, ascending=False)Binary number representation of n as list
fromBase (v, b, ascending=False)Converts v from the base b numeral system to a number
toBase (n, b, ascending=False)n in the base b numeral system

Class methods (static methods)

binary

binary(n)

Usage: NumeralSystem.binary(n, ascending=False)

Description:
Binary number representation of n as list
Abbreviation for toBase(n,2)
Example:
NumeralSystem.binary(11) returns [1, 0, 1, 1].
See also toBase, fromBase.


fromBase

fromBase(v, b)

Usage: NumeralSystem.fromBase(v, b, ascending=False)

Description:
Converts v from the base b numeral system to a number
v is expected as list of digits.
See also toBase, binary.


toBase

toBase(n, b)

Usage: NumeralSystem.toBase(n, b, ascending=False)

Description:
n in the base b numeral system
The result is returned as a list of the digits.
See also binary, fromBase.