NumeralSystem
Class NumeralSystem
: Numeral Systems
This is a static class (only static methods available).
Overview:
Method | Meaning |
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 |
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(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(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
.