Repository navigation
crnumerics 0.4.0
crdist grows from the inverse of the normal distribution into the normal distribution: four more functions, correctly rounded, the 16-bit formats, and samplers whose draws are the same bits on every machine.
New functions, correctly rounded to nearest: ndtr (Phi, R's pnorm), log_ndtr (log Phi, also where Phi underflows: log_ndtr(-40) is -804.6084), normpdf and logit. Every one of the 2^32 binary32 inputs of each was checked against MPFR, with none differing.
All seven functions now also take binary16 and bfloat16 (crdist_ndtr_f16, crdist_ndtr_bf16 and so on, on bit patterns), each correctly rounded in its own format from the same binary64 values; every 16-bit input was checked against MPFR. Rounding the binary32 result again to 16 bits would have been wrong on up to 150 inputs of a function.
Samplers: uniform, normal, exponential, gamma, beta, chi-squared and Student t, from a Philox4x32-10 stream (seed, substream, index). A variate has no exact value to round, so crdist.h specifies each one as a fixed sequence of correctly rounded operations, and every machine gives the same bits. The check recomputes that specification with MPFR, tests the distributions, and records fingerprints of fixed streams, which another implementation of the specification can check itself against.
make install now installs crdist too: libcrdist.so.0, libcrdist.a, crdist.h and crdist.pc for pkg-config (Linux).
From Python, the crdist module (pip install crdistr) gives the functions over NumPy arrays, the format following the dtype, and crdist.Stream with the samplers.
ival, crsum, crnn and lowp are unchanged; ival's soname is still libival.so.0.