Skip to main content

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, poisson, binomial (int64) 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 (x86-64, aarch64) and macOS (Apple Silicon). 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.10.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for crdistr 0.10.0
File Size Uploaded
crdistr-0.10.0.tar.gz 10.0 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for crdistr 0.10.0
File Interpreter ABI Platform
crdistr-0.10.0-py3-none-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl Python 3 none Linux glibc 2.26+ x86-64, Linux glibc 2.28+ x86-64 Details
crdistr-0.10.0-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
crdistr-0.10.0-py3-none-macosx_11_0_arm64.whl Python 3 none macOS 11.0+ ARM64 Details

Total release size: 258.3 kB

Release files / crdistr-0.10.0.tar.gz

Download URL crdistr-0.10.0.tar.gz
Size 10.0 kB
Tags Source
SHA-256 checksum
How to use checksums
8847ecf4a038dd3f81ab89f7fb2c0ce87dcb33daff03e466334f9b2697265db9
BLAKE2b-256 checksum
How to use checksums
d5e267d02797a6b9c8590ef69c73c1370f8ecab761d219db42e0d6835cb83ce2
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 15, 2026.

Transparency log

Release files / crdistr-0.10.0-py3-none-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl

Download URL crdistr-0.10.0-py3-none-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl
Size 87.8 kB
Tags Linux glibc 2.26+ x86-64 Linux glibc 2.28+ x86-64 Python 3
SHA-256 checksum
How to use checksums
d42d68e067db5e858e4b43b4a459187bf0c6640ff817eacbba2e0df3d0ccafa0
BLAKE2b-256 checksum
How to use checksums
34de60425fdc0b119a90afc8c68f5c5a3f13672067a80bc91712c45516322524
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 15, 2026.

Transparency log

Release files / crdistr-0.10.0-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl

Download URL crdistr-0.10.0-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Size 83.7 kB
Tags Linux glibc 2.17+ ARM64 Linux glibc 2.28+ ARM64 Python 3
SHA-256 checksum
How to use checksums
19c73b1efbffddc571e034d9117d2241f421c406339b89d891fb165b729afbdc
BLAKE2b-256 checksum
How to use checksums
9f8ad2a01e8e3e2481c55384bcf302b492680161874f33ca289b205d87ddd648
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 15, 2026.

Transparency log

Release files / crdistr-0.10.0-py3-none-macosx_11_0_arm64.whl

Download URL crdistr-0.10.0-py3-none-macosx_11_0_arm64.whl
Size 76.8 kB
Tags Python 3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
f8ca0be4d7bfdac08cb9315cf18f824d44cf8e5e7e01707a8fd79db90ef3ba2f
BLAKE2b-256 checksum
How to use checksums
1ff3a6c0bc6c523e16bf01abc5e25e07a60b49581621354b91e07aff7051f329
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 15, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.10.0 This release

4 release files

0.5.0

4 release files

0.4.1

3 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page