FlexFloat 1.0.0 Documentation๏
Welcome to FlexFloat 1.0.0, a high-precision Python library for arbitrary precision floating-point arithmetic with growable exponents and fixed-size fractions.
FlexFloat extends IEEE 754 double-precision format to handle numbers beyond the standard range while maintaining computational efficiency and precision consistency.
โจ Key Features๏
๐ข Growable Exponents: Dynamically expand exponent size to handle extremely large (>10^308) or small (<10^-308) numbers
๐ฏ Fixed-Size Fractions: Maintain IEEE 754-compatible 52-bit fraction precision for consistent accuracy
โก Full Arithmetic Support: Addition, subtraction, multiplication, division, and power operations
๐ Complete Math Library: Comprehensive mathematical functions including trigonometric, logarithmic, exponential, and hyperbolic functions
๐ง Multiple BitArray Backends: Choose between bool-list, int64-list, and big-integer implementations for optimal performance
๐ Special Value Handling: Complete support for NaN, ยฑinfinity, and zero values
๐ก๏ธ Overflow Protection: Automatic exponent growth prevents overflow/underflow errors
๐ IEEE 754 Baseline: Fully compatible with standard double-precision format as the starting point
๐ Quick Start๏
Installation๏
pip install flexfloat
Basic Usage๏
from flexfloat import FlexFloat
from flexfloat.math import sin, cos, pi, exp, log
# Create FlexFloat numbers
x = FlexFloat.from_float(1.5)
y = FlexFloat.from_float(2.5)
# Basic arithmetic
result = x + y
print(result.to_float()) # 4.0
# Mathematical functions
angle = pi / FlexFloat.from_float(4.0) # ฯ/4 radians
sin_result = sin(angle) # sin(45ยฐ) โ 0.707
# Exponential and logarithmic functions
exp_result = exp(x) # e^1.5
log_result = log(y) # ln(2.5)
# Handle very large numbers that would overflow standard floats
large_a = FlexFloat.from_float(1e308)
large_b = FlexFloat.from_float(1e308)
large_result = large_a + large_b # No overflow!
Mathematical Functions๏
FlexFloat 1.0.0 includes a comprehensive mathematical function library:
from flexfloat.math import *
# Trigonometric functions
sin(x), cos(x), tan(x)
asin(x), acos(x), atan(x), atan2(y, x)
# Exponential and logarithmic functions
exp(x), expm1(x), pow(x, y)
log(x), log10(x), log2(x), log1p(x)
# Hyperbolic functions
sinh(x), cosh(x), tanh(x)
asinh(x), acosh(x), atanh(x)
# Square root functions
sqrt(x), cbrt(x)
# Mathematical constants
pi, e, tau, inf, nan
# Utility functions
ceil(x), floor(x), fabs(x), fmod(x, y)
๐ Table of Contents๏
User Guide
API Reference
Math Library
- Math Module
exp()
expm1()
pow()
log()
log10()
log1p()
log2()
cbrt()
sqrt()
acos()
asin()
atan()
atan2()
cos()
degrees()
radians()
sin()
tan()
acosh()
asinh()
atanh()
cosh()
sinh()
tanh()
copysign()
fabs()
isfinite()
isinf()
isnan()
ceil()
dist()
erf()
erfc()
floor()
fma()
fmod()
frexp()
fsum()
gamma()
hypot()
isclose()
ldexp()
lgamma()
modf()
nextafter()
remainder()
trunc()
ulp()
- Logarithmic Functions
- Exponential Functions
- Power Functions
๐ API Documentation๏
Core Classes๏
|
A class to represent a floating-point number with growable exponent and fixed-size fraction. |
BitArray Implementations๏
|
Protocol defining the interface for BitArray implementations. |
|
A bit array class that encapsulates a list of booleans with utility methods. |
|
A memory-efficient bit array class using a list of int64 values. |
|
A memory-efficient bit array class using Python's infinite-size int. |
Math Functions๏
flexfloat.math - Mathematical Functions for FlexFloat |
๐ Indices and Tables๏
๐ค Contributing๏
We welcome contributions! Please see our Contributing Guide for details on how to get started.
๐ License๏
This project is licensed under the MIT License - see the License file for details.
๐ฌ Support๏
If you encounter any issues or have questions, please:
Check the documentation
Search existing GitHub issues
Create a new issue if needed
๐ Version Information๏
This documentation is for FlexFloat version 1.0.