crdistr: crdist for Python
The normal distribution over NumPy arrays, from crnumerics' C library libcrdist: erfinv, erfcinv, probit
(the standard normal quantile: R's qnorm, SciPy's ndtri), ndtr, log_ndtr, normpdf and logit, correctly
rounded to nearest in binary32, binary16 and bfloat16, every input of each checked against MPFR on x86-64 and
aarch64; and samplers on a Philox4x32-10 stream. The results are the same bits on every machine, in any
floating-point environment.
import numpy as np, crdistr
crdistr.probit(np.float32(0.975)) # 1.959964, the float32 nearest the exact quantile
u = np.random.default_rng(1).random(10, dtype=np.float32)
z = crdistr.probit(u) # normal draws: the same everywhere for the same u
crdistr.erfinv(np.array([0.1, 0.5], np.float16)) # binary16 in, binary16 out, rounded once
crdistr.log_ndtr(np.float32(-40)) # log Phi(-40) = -804.6084, where Phi underflows binary64
s = crdistr.Stream(seed=42) # Philox4x32-10, (seed, substream, index)
g = s.gamma(1000, shape=2.5) # the same bits on every machine
Also ndtr (Phi), normpdf and logit, correctly rounded like the inverses; and Stream's uniform,
normal, exponential, gamma, beta, chisquared, student_t and words, whose bits are fixed by the
specification in crdist.h (the tests check the binding against its recorded fingerprints).
The format follows the input. float16 arrays use binary16, and ml_dtypes' bfloat16 arrays use bfloat16; for
bfloat16 bit patterns given as uint16, use erfinv_bf16, erfcinv_bf16 and probit_bf16. float32 uses
binary32. Anything else is converted to float32 first, rounded to nearest, so a float64 0.1 becomes float32's 0.1
before the function sees it.
The library is libcrdist.so.0, from crnumerics' make install (or CRDIST_LIBRARY naming it). The tests
(make crdist-python-check at crnumerics' root) compare results with mpmath, rounded once to each format.
Linux only for now. pip install crdistr, then import crdistr: the name is crdistr on PyPI and as a module,
"crdist" on PyPI being an unrelated project (the C library is still crdist: libcrdist, crdist.h).
Metadata
Release files for crdistr 0.4.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| crdistr-0.4.1.tar.gz | 8.4 kB | Details |
Built distributions (wheels)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| crdistr-0.4.1-py3-none-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl | Python 3 | none | Linux glibc 2.28+ x86-64, Linux glibc 2.26+ x86-64 | Details |
| crdistr-0.4.1-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl | Python 3 | none | Linux glibc 2.17+ ARM64, Linux glibc 2.28+ ARM64 | Details |
Total release size: 171.3 kB
Release files / crdistr-0.4.1.tar.gz
| Download URL | crdistr-0.4.1.tar.gz |
|---|---|
| Size | 8.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6d39c408049a4210289a64ce207a0756e3418e4230cfa88e6295684099838503
|
|
BLAKE2b-256 checksum How to use checksums |
943c932e0237a7ac189de63cf41065554340cf7b99b3554a72f704e0ca403ca2
|
| 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 Oct 13, 2026.
Transparency logRelease files / crdistr-0.4.1-py3-none-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl
| Download URL | crdistr-0.4.1-py3-none-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 83.4 kB |
| Tags | Linux glibc 2.26+ x86-64 Linux glibc 2.28+ x86-64 Python 3 |
|
SHA-256 checksum How to use checksums |
03fdd6e2b6e7e9b400bee7ac9272d149f7f3c313b53d0fc42e9433acdab96a7b
|
|
BLAKE2b-256 checksum How to use checksums |
9d135e11151400fdc608d73ab5aa5cd55b38b86e8615644ec8216071842f3e95
|
| 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 Oct 13, 2026.
Transparency logRelease files / crdistr-0.4.1-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
| Download URL | crdistr-0.4.1-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl |
|---|---|
| Size | 79.6 kB |
| Tags | Linux glibc 2.17+ ARM64 Linux glibc 2.28+ ARM64 Python 3 |
|
SHA-256 checksum How to use checksums |
9fa6d01932419bd872e378442bccfa4a5589a8eccad26160201b5c3f1c7dc358
|
|
BLAKE2b-256 checksum How to use checksums |
86e8a89dad6583c47991019082546acb66ed2626d2109878b07d5d1a5dd1c5e1
|
| 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 Oct 13, 2026.
Transparency log