Skip to main content

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

  • addBignum
  • subBignum
  • multBignum
  • divBignum

Math Functions

  • lnBignum
  • Log10
  • Logx
  • expBignum
  • sqrtBignum
  • cubrtBignum
  • nthrtBignum
  • factBignum

Utilities

  • compareBignum
  • roundBignum
  • floorBignum
  • absBignum
  • recipBignum
  • isZero

Configuration

The module includes configurable globals:

Variable Description
SF Significant figures (default 5)
SafeMode Prevents very expensive calculations

Limitations

  • toInteger() only converts values between 1e-10 and 1e10.
  • Precision depends on floating-point mantissa accuracy.
  • Some operations are restricted when SafeMode is 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


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

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

aurea_bignum_library_python-0.1.0-py3-none-any.whl (9.2 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for aurea_bignum_library_python-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0adcccd991531f848a6798070ceb9204134831d86c6f749943de4ca98557dc31
MD5 f372fef9270dbb4164de5473ea34a5d1
BLAKE2b-256 45fdc1c3bc48733ecd79b47f636c8cefbed2261c01ca1940130e3ce8cb499237

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