Skip to main content

A Python library for efficient radix-based number system conversions, specializing in cyclic fractions handling, for bases 2 through 36.

Reason this release was yanked:

fatal got into upstream

Project description

✨ RadixHopper ✨

PyPI - Version PyPI - Python Version


🌟 Hop between number bases with ease! 🌟

RadixHopper is a Python library for efficient radix-based number system conversions, specializing in cyclic fractions handling, for arbitary bases with arbitary digits (defaults to 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ digit-set).

✨ Features

  • 🔢 Convert numbers between radices 2 to 36 out-of-the-box, and more with custom digits!
  • 🧑‍🔬 Support for scientific notation
  • 🦅 Arbitary precision operations, by leveraging fractions
  • 🖥️ Support for 0x, 0o and 0b format
  • 🔄 Handle cyclic fractions with grace
  • 🚀 Fast evaluations with conversion buffering
  • 📓 Jupyter notebook support
  • 🎨 Intuitive CLI interface

🌠 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 --num 3.14 --base-from 10 --base-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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

radixhopper-0.1.0.tar.gz (109.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

radixhopper-0.1.0-py3-none-any.whl (16.7 kB view details)

Uploaded Python 3

File details

Details for the file radixhopper-0.1.0.tar.gz.

File metadata

  • Download URL: radixhopper-0.1.0.tar.gz
  • Upload date:
  • Size: 109.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.1

File hashes

Hashes for radixhopper-0.1.0.tar.gz
Algorithm Hash digest
SHA256 342510aeafbc328d4c84dcfb26f2495b27288e75f39c655f48d30b8a3fbcfd8d
MD5 72a69413ba34a8a7eda32345a303ac3f
BLAKE2b-256 f14a345b91e793a2dc6be32c76dfce5c483fb6db9456d2aa1cf82bdcba467e59

See more details on using hashes here.

File details

Details for the file radixhopper-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: radixhopper-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 16.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.1

File hashes

Hashes for radixhopper-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5ab7c99cecda9f23168ed23905cc762e44ac1bdd76f874aa1b37d6b762b66567
MD5 7a9686bbd3a7eb2154f32ecd237dec11
BLAKE2b-256 eb66159eff2b71095bf802073d7dc0871fd5de3ce04271f5a2ea6cd50d14c2ff

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page