JuliaStats / Distributions.jl

A Julia package for probability distributions and associated functions.
Other
1.08k stars 410 forks source link

Fix type unstable `Uniform` #1797

Closed prbzrg closed 8 months ago

prbzrg commented 8 months ago

this fixes:

julia> dist = Uniform{Float32}(-0.1f0, 0.1f0)
Uniform{Float32}(a=-0.1f0, b=0.1f0)

julia> typeof(rand(dist))
Float64
devmotion commented 8 months ago

See https://github.com/JuliaStats/Distributions.jl/pull/1796 and other discussions in the repo for why this is inconsistent with the current design of Distributions.