Julia: BigFloat Normal distribution

420 Views Asked by At

In Julia has anyone implemented the normal distributions pdf or cdf to support arbitrary precision BigFloats.

For example this code returns 0.0, when in fact the values should be slightly different.

x = parse(BigFloat, "2.1")
x_small = float64(x)
pdf(Normal(), x) - pdf(Normal(), x_small)
1

There are 1 best solutions below

0
Simon Byrne On BEST ANSWER

Not directly. My eventual plan is to make Distribution types parametric, which would also allow for Float32 arguments, but that is a while away yet.

In the meantime, there is the non-exported φ which gives the result you wanted:

Distributions.φ(x) - pdf(Normal(), x_small)