A Python library for efficient radix-based number system conversions, specializing in cyclic fractions handling, for bases 2 through 36.
Project description
✨ RadixHopper ✨
🌟 Hop between number bases with ease! 🌟
RadixHopper is a python library and terminal utility for flexible numerical radix (a.k.a base) conversions, specializing in cyclic fractions handling, for arbitrary bases with arbitrary digits, with sane default and crazy levels of customization.
✨ Features
- 🔢 Convert numbers between radices 2 to 36 out-of-the-box, and more with custom digits!
- 🧑🔬 Support for scientific notation
- 🦅 Arbitrary precision operations, by leveraging fractions
- 🖥️ Support for
0x,0oand0bformat - 🔄 Handle cyclic fractions with grace
- 🚀 Fast evaluations with conversion buffering
- 📓 Jupyter notebook support
- 🎨 Intuitive CLI interface
- 🌈 And alot more...
🌠 Installation
Sprinkle some magic into your Python environment:
pip install radixhopper
🎭 Usage
As a library
from radixhopper import RadixNumber
# Create a RadixNumber instance from a string in base 10
num = RadixNumber("3.14", base=10)
# Convert it to base 2
result = num.to(base=2)
# Print the representation in base 2
print(f"{result!r}") # or simply `>>> result` or print(repr(result))
# >>> RadixNumber(number=11.0[01000111101011100001], representation_base=2, digits=0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ, case_sensitive=False, fraction=(157/50))
# Access the string representation directly
print(result)
# >>> 11.0[01000111101011100001]
# Perform operations
num2 = RadixNumber("1.1", base=2) # Represents 1.5 in base 10
sum_result = num + num2 # Operations default to Fraction representation
print(sum_result) # >>> 100.[10100011110101110000]
print(sum_result.to(base=10)) # >>> 4.64
CLI
radixhopper 3.14 --from 10 --to 2
or simply
radixhopper 3.14 10 2
🌟 Contributing
We welcome contributions! Please check our Issues page for open tasks or suggest new features.
📜 License
radixhopper is distributed under the terms of the MIT license.
🌠 Star Gazing
* . . * * . . . * ..
. * . ✨ . . * . *
*. * . . * . * . . *
. . * . ✨ . . . .
. *. . . * . * . . *
* . . . . . . . .
. . . ✨ * . . * *
. * * . . * . * . .
. . . . . .
* . . * . * . . *
Happy hopping! ✨🐰✨
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file radixhopper-1.0.0.tar.gz.
File metadata
- Download URL: radixhopper-1.0.0.tar.gz
- Upload date:
- Size: 91.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
81202a7cf6c14788fb7549f3dec2aa60078595a0825ff0a75dcaee13b84881f2
|
|
| MD5 |
02e8d6696301042a4f55aae9dfad8869
|
|
| BLAKE2b-256 |
7ff0b808c39dd0a226848a4878da7d61b39f45d317e0fe9e723f8d7b4c62a6ff
|
Provenance
The following attestation bundles were made for radixhopper-1.0.0.tar.gz:
Publisher:
publish.yml on aarmn/radixhopper
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
radixhopper-1.0.0.tar.gz -
Subject digest:
81202a7cf6c14788fb7549f3dec2aa60078595a0825ff0a75dcaee13b84881f2 - Sigstore transparency entry: 340334520
- Sigstore integration time:
-
Permalink:
aarmn/radixhopper@fe737c81af87302e9d98c4f831c4218c843c0dc5 -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/aarmn
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@fe737c81af87302e9d98c4f831c4218c843c0dc5 -
Trigger Event:
push
-
Statement type:
File details
Details for the file radixhopper-1.0.0-py3-none-any.whl.
File metadata
- Download URL: radixhopper-1.0.0-py3-none-any.whl
- Upload date:
- Size: 17.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
845582a581b66ce39a910de460653c101f9ff15896c6e7aaf09774628c6fa963
|
|
| MD5 |
356822fa0e580e38e6b48e9b7d54ae53
|
|
| BLAKE2b-256 |
c42e6527a4020987dadad09ccf7db193d0a007a0a04991eeb8af9936b4d3b6c2
|
Provenance
The following attestation bundles were made for radixhopper-1.0.0-py3-none-any.whl:
Publisher:
publish.yml on aarmn/radixhopper
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
radixhopper-1.0.0-py3-none-any.whl -
Subject digest:
845582a581b66ce39a910de460653c101f9ff15896c6e7aaf09774628c6fa963 - Sigstore transparency entry: 340334539
- Sigstore integration time:
-
Permalink:
aarmn/radixhopper@fe737c81af87302e9d98c4f831c4218c843c0dc5 -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/aarmn
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@fe737c81af87302e9d98c4f831c4218c843c0dc5 -
Trigger Event:
push
-
Statement type: