Search code examples
juliaarbitrary-precisionbigfloat

Julia: BigFloat Normal distribution


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)

Solution

  • 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)