A python module for handling big numbers with arbitrary precision.
Project description
bignum
A Python module for representing and computing with extremely large or extremely small numbers using a structured scientific-notation system instead of native numeric types.
Unlike standard floats or integers, bignum stores numbers as dictionaries containing sign, mantissa, exponent, exponent sign, magnitude layer, and imaginary flag. This allows it to represent values far beyond Python’s built-in numeric limits while still supporting arithmetic and mathematical functions.
Features
- Arbitrary-scale number representation
- Supports exponent layers (
e,ee,eee, …) - Arithmetic operations
- Logarithms and exponentials
- Roots and powers
- Factorials
- Imaginary number support
- Configurable precision
- Safe mode for preventing expensive operations
Number Format
Each number is stored internally as:
{
'sign': '+' | '-',
'mantissa': float,
'exponent': int,
'exponentsign': '+' | '-',
'magnitude': int,
'imaginary': bool
}
Example:
1e10 → +1.0e10
1ee10 → +1.0ee10
Magnitude represents repeated exponent layers.
Installation
pip install bignum
Quick Example
from bignum import *
a = fromInteger(4000)
b = fromInteger(200)
print(toScientific(addBignum(a, b)))
Output:
+4.2e3
Supported Operations
Arithmetic
addBignumsubBignummultBignumdivBignum
Math Functions
lnBignumLog10LogxexpBignumsqrtBignumcubrtBignumnthrtBignumfactBignum
Utilities
compareBignumroundBignumfloorBignumabsBignumrecipBignumisZero
Configuration
The module includes configurable globals:
| Variable | Description |
|---|---|
SF |
Significant figures (default 5) |
SafeMode |
Prevents very expensive calculations |
Limitations
toInteger()only converts values between1e-10and1e10.- Precision depends on floating-point mantissa accuracy.
- Some operations are restricted when
SafeModeis enabled.
Use Cases
bignum is useful for:
- Scientific experimentation
- Simulating extreme growth systems
- Studying large exponent structures
- Mathematical modeling beyond float limits
License
See LICENSE.txt for details.
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 Distributions
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 aurea_bignum_library_python-0.1.0-py3-none-any.whl.
File metadata
- Download URL: aurea_bignum_library_python-0.1.0-py3-none-any.whl
- Upload date:
- Size: 9.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0adcccd991531f848a6798070ceb9204134831d86c6f749943de4ca98557dc31
|
|
| MD5 |
f372fef9270dbb4164de5473ea34a5d1
|
|
| BLAKE2b-256 |
45fdc1c3bc48733ecd79b47f636c8cefbed2261c01ca1940130e3ce8cb499237
|