radices
— Arithmetic for any positional notation systems
kanon.units.radices Module
In this module we define RadixBase and BasedReal. RadixBase is the basis of the way we work with different radices. BasedReal are a class of Real numbers with a 1-1 relation with a RadixBase.
>>> from kanon.units import RadixBase, radix_registry
>>> example_base = RadixBase([20, 5, 18], [24, 60], "example_base", [" ","u ","sep "])
>>> number = radix_registry["ExampleBase"]((8, 12, 3, 1), (23, 31))
>>> number
08 12u 3sep 01 ; 23,31
>>> float(number)
15535.979861111111
Classes
|
A class representing a numeral system. |
|
Abstract class allowing to represent a value in a specific |
Variables
Registry containing all instanciated BasedReal classes. |