RadixBase

class kanon.units.radices.RadixBase(left: Sequence[int], right: Sequence[int], name: str, integer_separators: Optional[Sequence[str]] = None)[source] [edit on github]

Bases: object

A class representing a numeral system. A radix must be specified at each position, by specifying an integer list for the integer positions, and an integer list for the fractional positions.

Definition of a numeral system. A radix must be specified for each integer position (left argument) and for each fractional position (right argument). Note that the integer position are counted from right to left (starting from the ‘;’ symbol and going to the left).

Parameters
  • left – Radix list for the integer part

  • right – Radix list for the fractional part

  • name – Name of this numeral system

  • integer_separators – List of string separators, used for displaying the integer part of the number

Methods Summary

factor_at_pos(pos)

Returns an int factor corresponding to a digit at position pos.

Methods Documentation

factor_at_pos(pos: int) int[source] [edit on github]

Returns an int factor corresponding to a digit at position pos. This factor is an integer, when dealing with fractional position you should invert the result to find relevant factor.

>>> Sexagesimal.base.factor_at_pos(-2)
3600
>>> Sexagesimal.base.factor_at_pos(0)
1
Parameters

pos (int) – Position of the digit

Returns

Factor at pos

Return type

int