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.5.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.5.0
File Size Uploaded
crdistr-0.5.0.tar.gz 8.9 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for crdistr 0.5.0
File Interpreter ABI Platform
crdistr-0.5.0-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.5.0-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl Python 3 none Linux glibc 2.28+ ARM64, Linux glibc 2.17+ ARM64 Details
crdistr-0.5.0-py3-none-macosx_11_0_arm64.whl Python 3 none macOS 11.0+ ARM64 Details

Total release size: 255.1 kB

Release files / crdistr-0.5.0.tar.gz

Download URL crdistr-0.5.0.tar.gz
Size 8.9 kB
Tags Source
SHA-256 checksum
How to use checksums
2b6d77c8b086c6282b0a445e4e9d9c5b6c325370769efb3aac427b52d6344534
BLAKE2b-256 checksum
How to use checksums
a60d1a53ee788e2b63dd46fba37894d3270bbb1aa6ebe82be4bd615b556691b8
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

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

Download URL crdistr-0.5.0-py3-none-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl
Size 87.1 kB
Tags Linux glibc 2.26+ x86-64 Linux glibc 2.28+ x86-64 Python 3
SHA-256 checksum
How to use checksums
e1a64b3aaf8346c305d32b2847541a286636482a24bd17288a333dd21f92c4cf
BLAKE2b-256 checksum
How to use checksums
5522df6f7ad60fb599bf401bd21050fb823741020b9462094ade87cb107fc160
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

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

Download URL crdistr-0.5.0-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Size 83.0 kB
Tags Linux glibc 2.17+ ARM64 Linux glibc 2.28+ ARM64 Python 3
SHA-256 checksum
How to use checksums
23ce15e2c7be88f0523b4e268c0fcbdfb0888f31d65c7fe8175e0d88629cc21a
BLAKE2b-256 checksum
How to use checksums
cdec729bfbbaab7547dec5005d868ef86dbab84021ff8ea2b4a6e969fb501fa0
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

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

Download URL crdistr-0.5.0-py3-none-macosx_11_0_arm64.whl
Size 76.2 kB
Tags Python 3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
110301095865107034de4e259d38978f307473063ac0bb6ed4a24e5cede314b2
BLAKE2b-256 checksum
How to use checksums
b5a639403b8a5d16ca40bd5b88daeccf35246e5fc662b7cfc8ba21393f160924
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

Release history Release notifications | RSS feed

0.10.0

4 release files

This release

0.5.0 This release

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