An open API service indexing awesome lists of open source software.

https://github.com/grandmoff100/betternumbers

Different base Numbers with useful methods.
https://github.com/grandmoff100/betternumbers

Last synced: 4 months ago
JSON representation

Different base Numbers with useful methods.

Awesome Lists containing this project

README

          

# Better Numbers!

### ``class N`` Methods
Deals with **integers** in all bases greater than one.
> Note: Floats not implemented yet.

- ``n.to_base_ten()``
Returns the base ten equivalent of ``n``
- ``n.to_base(self, b: int)``
Return the base ``b`` equivalent of ``n``

### ``class N`` Operations
For the following operations, if they are in different bases it returns the result in the base of the first number.
- `` - ``
Subtracts the two numbers.
- `` + ``
Adds the two numbers.
- `` * ``
Multiplies the two numbers.
- `` / ``
Divides the two numbers, and returns an integer.
- `` % ``
Remainder/Modulo function.
- ``abs()``
Return the absolute value of ``n``.
- ``n.op(func, *others)``
Returns the result of ``func(n, *others)``, if other operations aren't enough.
- ``n.is_prime()``
Return the boolean value of if it's a prime or not.