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

Project Activity

See All Activity >

License

MIT License

Follow Mixed-Radix-Numbers

Mixed-Radix-Numbers Web Site

Other Useful Business Software
Earn up to 16% annual interest with Nexo. Icon
Earn up to 16% annual interest with Nexo.

Let your crypto work for you

Put idle assets to work with competitive interest rates, borrow without selling, and trade with precision. All in one platform. Geographic restrictions, eligibility, and terms apply.
Get started with Nexo.
Rate This Project
Login To Rate This Project

User Reviews

Be the first to post a review of Mixed-Radix-Numbers!

Additional Project Details

Programming Language

Python

Registered

2020-11-19