UniMath for Python
Multi-precision numeric types and mathematical functions for Python, backed by the native UniMath library.
UniMath provides arbitrary-precision integers and binary floating-point numbers, exact rational arithmetic, Q-format fixed-point numbers, and interval arithmetic. It also exposes roots, transcendental functions, special functions, constants, and conversions between numeric types.
Install
pip install UniMath-lituus
Prebuilt wheels include the native UniMath library for Linux, macOS, and Windows on CPython 3.10–3.14. Installing a wheel needs neither Nim nor a C compiler.
The distribution is named UniMath-lituus; the Python package is imported as
unimath:
import unimath
print(unimath.__version__)
Quick start
from unimath import BigInt, BigFloat, Rational, Fixed, Interval
# Arbitrary-precision integers
n = BigInt(10**30)
print(n * n) # 10**60
# Arbitrary-precision binary floating point
x = BigFloat(10)
print((x / BigFloat(3)).to_f64()) # 3.3333333333333335
# Exact rational arithmetic
q = Rational(1, 2) + Rational(1, 3)
print(q) # 5/6
# Q-format fixed-point arithmetic
price = Fixed(19.95, frac_bits=32)
quantity = Fixed(3, frac_bits=32)
print((price * quantity).value()) # approximately 59.85
# Directed-rounding interval arithmetic
domain = Interval(4.0, 9.0)
print(domain.sqrt()) # interval enclosing [2, 3]
Numeric types
| Type | Purpose |
|---|---|
BigInt |
Arbitrary-precision signed integers |
BigFloat |
Arbitrary-precision binary floating-point numbers |
Rational |
Exact reduced fractions backed by BigInt |
Fixed |
Signed Q-format fixed-point numbers |
Interval |
Directed-rounding intervals enclosing the true result |
BigComplex |
Complex numbers with arbitrary-precision components |
RationalComplex |
Exact Gaussian rationals, unbounded |
FixedComplex |
Complex numbers in Q-format fixed point |
The core types support familiar Python operators such as +, -, *,
comparisons, and the division operations appropriate to each type.
Complex numbers
The square root of a negative number is not real, and neither is the
logarithm. sqrt and log return a complex there instead of raising, and the
argument's type decides which complex:
from unimath import sqrt, log, BigFloat, Rational
sqrt(-1) # 1j
sqrt(4) # 2.0
log(-1) # 3.141592653589793j
sqrt(BigFloat(-1.0)) # BigComplex(0.0, 1.0)
sqrt(Rational(-1)) # RationalComplex(...)
Complex arithmetic over float64 takes and returns Python's builtin
complex, so results drop straight into cmath or NumPy:
from unimath import ComplexMath
cm = ComplexMath()
cm.abs(3 + 4j) # 5.0
cm.sqrt(-3 - 4j) # (1-2j)
cm.div(complex(1e300, 1e300), complex(1e300, 1e300)) # (1+0j), not NaN
The multi-precision, exact and fixed-point backends have their own classes.
BigComplex carries the full transcendental set; RationalComplex keeps
+ - * /, conj, norm2 and integer powers exact and offers abs/sqrt as
the only approximations, since a root leaves the rationals.
Square roots and logarithms take principal values, with the branch cut along
the negative real axis. Signed zero is not distinguished: a negative real
always yields the +i root.
Mathematical functions
| Category | Python API |
|---|---|
| Roots | Roots |
| Exponential and logarithmic functions | Exponential |
| Trigonometry | Trigonometry |
| Hyperbolic functions | Hyperbolic |
| Special functions | Special |
| Big-float mathematics | FloatMath |
| Rational mathematics | RationalMath |
| Fixed-point mathematics | MathRouter |
| Complex mathematics (float64) | ComplexMath |
| Mathematical constants | Constants |
| Range reduction | Reduction |
| Numeric conversions | Conversions |
The API includes sin, cos, exp, ln, sqrt, atan, hyperbolic
functions, erf, gamma, Bessel functions, orthogonal polynomials, and
conversions between UniMath numeric types.
For an executable tour of the API, see the Python quickstart notebook.
Links
- Source, Nim API, C ABI, and design records: https://github.com/lituus-lab/UniMath
- Documentation: https://lituus-lab.github.io/UniMath/
- Issues: https://github.com/lituus-lab/UniMath/issues
- License: Apache-2.0
Development
Building from source requires Nim, Nimble, a C compiler, and Cython.
nimble install -y
nimble pyLib
cd py
python3 setup.py build_ext --inplace
python3 -m pytest -q
Metadata
Release files for UniMath-lituus 1.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| unimath_lituus-1.1.0.tar.gz | 458.6 kB | Details |
Built distributions (wheels)
Total release size: 13.4 MB
Release files / unimath_lituus-1.1.0.tar.gz
| Download URL | unimath_lituus-1.1.0.tar.gz |
|---|---|
| Size | 458.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
aaed3b0df028b7949695e756342d66bc360b7807ae63a1b92300fbe9623f1f53
|
|
BLAKE2b-256 checksum How to use checksums |
5c6db5bd049a72f42a9c48c50b0c7ae871299bcd26c64917de26f2adfc6c1e56
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 31, 2026.
Transparency logRelease files / unimath_lituus-1.1.0-cp314-cp314-win_amd64.whl
| Download URL | unimath_lituus-1.1.0-cp314-cp314-win_amd64.whl |
|---|---|
| Size | 345.7 kB |
| Tags | CPython 3.14 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
9298147930df86868db77777b5ee54cb59aed0709138a0dcea718b4827da6687
|
|
BLAKE2b-256 checksum How to use checksums |
1d513dea36c1c5bbb927740139b1d110faa9ddc0be982b0e49277c62ebd5422e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 31, 2026.
Transparency logRelease files / unimath_lituus-1.1.0-cp314-cp314-manylinux_2_35_x86_64.whl
| Download URL | unimath_lituus-1.1.0-cp314-cp314-manylinux_2_35_x86_64.whl |
|---|---|
| Size | 1.6 MB |
| Tags | CPython 3.14 Linux glibc 2.35+ x86-64 |
|
SHA-256 checksum How to use checksums |
9849ff7b268b10cb0cabc610b9cb4856824fe62de6163507c47e3566a69813d7
|
|
BLAKE2b-256 checksum How to use checksums |
70e90692d3f823696947aae49ba79ff99bcc6caf16e589105474101fca1f24f7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 31, 2026.
Transparency logRelease files / unimath_lituus-1.1.0-cp314-cp314-macosx_10_15_x86_64.macosx_26_0_arm64.whl
| Download URL | unimath_lituus-1.1.0-cp314-cp314-macosx_10_15_x86_64.macosx_26_0_arm64.whl |
|---|---|
| Size | 602.8 kB |
| Tags | CPython 3.14 macOS 10.15+ x86-64 macOS 26.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
d6c0a48d03dbd1b007b71c6bbdc93befb0c2d6e0b7e4af8de90a82c8c92cb49d
|
|
BLAKE2b-256 checksum How to use checksums |
651d8aca1c8339dc7d44d83d7ac9745c8579ed2d53a4ce7b11d0c12f0b03513b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 31, 2026.
Transparency logRelease files / unimath_lituus-1.1.0-cp313-cp313-win_amd64.whl
| Download URL | unimath_lituus-1.1.0-cp313-cp313-win_amd64.whl |
|---|---|
| Size | 332.9 kB |
| Tags | CPython 3.13 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
ed13efcf2500a5a806eb2d3134b9f97d429e3addd0e3af3ca7715ebf54da55dd
|
|
BLAKE2b-256 checksum How to use checksums |
ce7b98b07c06ccd622f105307dc5ba69066deb6693e81a04bd7538d7c0aa694e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 31, 2026.
Transparency logRelease files / unimath_lituus-1.1.0-cp313-cp313-manylinux_2_35_x86_64.whl
| Download URL | unimath_lituus-1.1.0-cp313-cp313-manylinux_2_35_x86_64.whl |
|---|---|
| Size | 1.6 MB |
| Tags | CPython 3.13 Linux glibc 2.35+ x86-64 |
|
SHA-256 checksum How to use checksums |
16ceca94a7345ea1ed8dfd9d81625e7272fe3965a92bf1fc938351cdeaa3a586
|
|
BLAKE2b-256 checksum How to use checksums |
6da057c6f39634819b8f3871bc2c216212aaa90e90c945ffb1360c6cbb756ff4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 31, 2026.
Transparency logRelease files / unimath_lituus-1.1.0-cp313-cp313-macosx_10_13_x86_64.macosx_26_0_arm64.whl
| Download URL | unimath_lituus-1.1.0-cp313-cp313-macosx_10_13_x86_64.macosx_26_0_arm64.whl |
|---|---|
| Size | 588.4 kB |
| Tags | CPython 3.13 macOS 10.13+ x86-64 macOS 26.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
2f76a1f3c6238b61b6a1ca2396544fc7cf8b2596162eb1bb66296ec6a86e9668
|
|
BLAKE2b-256 checksum How to use checksums |
162eb19ff51418149743f8cfc37b584a2ce55207bbee4061dc00887e290349a2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 31, 2026.
Transparency logRelease files / unimath_lituus-1.1.0-cp312-cp312-win_amd64.whl
| Download URL | unimath_lituus-1.1.0-cp312-cp312-win_amd64.whl |
|---|---|
| Size | 332.9 kB |
| Tags | CPython 3.12 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
0d8afc39cc1ef0e1c04a39e575559491e2602ef9b03c298263d2cd0020502938
|
|
BLAKE2b-256 checksum How to use checksums |
a16cce11d8d8fa07a8a197dd899bd8ce3b52f409a759f438fa6c73f48b328eaf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 31, 2026.
Transparency logRelease files / unimath_lituus-1.1.0-cp312-cp312-manylinux_2_35_x86_64.whl
| Download URL | unimath_lituus-1.1.0-cp312-cp312-manylinux_2_35_x86_64.whl |
|---|---|
| Size | 1.6 MB |
| Tags | CPython 3.12 Linux glibc 2.35+ x86-64 |
|
SHA-256 checksum How to use checksums |
17e198d37d783a7b034bfa75e58124451a356d497c48cd8d02ae56a8d879b3ff
|
|
BLAKE2b-256 checksum How to use checksums |
a9b9a73e868b5d5d3f6b4965c9f311f9c45748f8bb2589fdddb25772849860d3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 31, 2026.
Transparency logRelease files / unimath_lituus-1.1.0-cp312-cp312-macosx_10_13_x86_64.macosx_26_0_arm64.whl
| Download URL | unimath_lituus-1.1.0-cp312-cp312-macosx_10_13_x86_64.macosx_26_0_arm64.whl |
|---|---|
| Size | 585.8 kB |
| Tags | CPython 3.12 macOS 10.13+ x86-64 macOS 26.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
2438780461b5415d4e581b6bcf63176f0fa3c3e6a2fbe70fee2f751b5441391b
|
|
BLAKE2b-256 checksum How to use checksums |
4695fea0c13eff01af0781dd2a2215bff68395beecc2d1eddec96d26d7b31a11
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 31, 2026.
Transparency logRelease files / unimath_lituus-1.1.0-cp311-cp311-win_amd64.whl
| Download URL | unimath_lituus-1.1.0-cp311-cp311-win_amd64.whl |
|---|---|
| Size | 334.9 kB |
| Tags | CPython 3.11 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
2a86c7cbdaa300776fa86fb9cc0aaba1731a79e4491110f7679ef5f401088a73
|
|
BLAKE2b-256 checksum How to use checksums |
f0d246cd29ae2513f1756cd22da38a73fb3ec6734cdeecfd3940c47027acdacd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 31, 2026.
Transparency logRelease files / unimath_lituus-1.1.0-cp311-cp311-manylinux_2_35_x86_64.whl
| Download URL | unimath_lituus-1.1.0-cp311-cp311-manylinux_2_35_x86_64.whl |
|---|---|
| Size | 1.7 MB |
| Tags | CPython 3.11 Linux glibc 2.35+ x86-64 |
|
SHA-256 checksum How to use checksums |
0cfc14ef3c6f8fe30b88d6a8ad43ccbdc46c6651ab04bd2751825afc3916026e
|
|
BLAKE2b-256 checksum How to use checksums |
e5c0323789e8ae5cadceb52d13744a1d522b895c6b38d699b22e2b3fab654d13
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 31, 2026.
Transparency logRelease files / unimath_lituus-1.1.0-cp311-cp311-macosx_10_9_x86_64.macosx_26_0_arm64.whl
| Download URL | unimath_lituus-1.1.0-cp311-cp311-macosx_10_9_x86_64.macosx_26_0_arm64.whl |
|---|---|
| Size | 608.6 kB |
| Tags | CPython 3.11 macOS 10.9+ x86-64 macOS 26.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
4c9aa63d215cd5c62047db193b56dcb420a9a64fc7cd401d53aca59801dd41fc
|
|
BLAKE2b-256 checksum How to use checksums |
0ee6f8dbd55b0e62170745a9e2d11be85940d07ec9d9c97784f28407c5073cf2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 31, 2026.
Transparency logRelease files / unimath_lituus-1.1.0-cp310-cp310-win_amd64.whl
| Download URL | unimath_lituus-1.1.0-cp310-cp310-win_amd64.whl |
|---|---|
| Size | 334.6 kB |
| Tags | CPython 3.10 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
2deb181862793496a31559b354a1c78a96e044e8075c0e454d050285d1c4d69d
|
|
BLAKE2b-256 checksum How to use checksums |
3c6b74702e77b35fe2132a87ab28f9027e2c5c177861884a49e43579b2098e80
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 31, 2026.
Transparency logRelease files / unimath_lituus-1.1.0-cp310-cp310-manylinux_2_35_x86_64.whl
| Download URL | unimath_lituus-1.1.0-cp310-cp310-manylinux_2_35_x86_64.whl |
|---|---|
| Size | 1.6 MB |
| Tags | CPython 3.10 Linux glibc 2.35+ x86-64 |
|
SHA-256 checksum How to use checksums |
5dfa38fa91faf76ac03a602937b013e7c5f16c44b58549e34cfd779f7300ac19
|
|
BLAKE2b-256 checksum How to use checksums |
f29da53954e0e248b1fe189b076bc17940eefe4fbd56e9af6d8161f916982f2a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 31, 2026.
Transparency logRelease files / unimath_lituus-1.1.0-cp310-cp310-macosx_26_0_arm64.macosx_10_9_x86_64.whl
| Download URL | unimath_lituus-1.1.0-cp310-cp310-macosx_26_0_arm64.macosx_10_9_x86_64.whl |
|---|---|
| Size | 606.5 kB |
| Tags | CPython 3.10 macOS 10.9+ x86-64 macOS 26.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
8cd79dc9ba683ec27b03295769ab46e99011811a9256966eba6434badf9e3fc1
|
|
BLAKE2b-256 checksum How to use checksums |
6cb1b59a91664d29fe8e41fc6cfd2b90b487c5e94507b09ffd0cbf38dbb17fb6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 31, 2026.
Transparency log