A module for arithmetic with mixed radix numbers like time.
Ex: 1:20 + 2 hours & 41 mins = 4:01 or how it's represented in the code, [1, 20] + [2, 41] = [4, 1]
This module can handle digits of given numbers that are greater than the given bases
Ex: 9,000 minutes + 1 hour & 20 minutes = 6 days, 7 hours, & 20 minutes. 9,000 is beyond base 60, but [9000] + [1, 20] will still give the correct result, [6, 7, 20].
Numbers are represented as lists. 10 and -99 need to be converted into [1, 0] & [-9, 9]. Negative numbers have the most significant digit in the list as a negative.
For numbers with established representations like hexadecimal where 10 = a, there is no support for that kind of representation. All values are represented as their decimal equivalent. To work with hexadecimal, the numbers would have to be converted from [2, A, B] to [2, 10, 11]. This is to allow for massive bases like base 9,000 since there isn't really a single character representation for 9,000.
Features
- add
- subtract