Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rand(Normal(0, BigFloat) vs. rand(Truncated(Normal(0, BigFloat), -BigFloat, BigFloat) #1944

Open
dtxl opened this issue Jan 29, 2025 · 1 comment

Comments

@dtxl
Copy link

dtxl commented Jan 29, 2025

For example,

ND = Normal(0, BigFloat(0.9494405736148620092025834791894757387152032108223086656526968847923188266391808634))
rand(ND)

delivers a random BigFloat number, but e.g.,

TND = Truncated(Normal(0, BigFloat(0.9494405736148620092025834791894757387152032108223086656526968847923188266391808634)), -BigFloat(0.59803458093499065738957049860890123908234890864982480984902834098902348590890823), BigFloat(0.78742907123879873489723984758971829378973485789476878139475891738475897345897981227))
rand(TND)

gives the ERROR: MethodError: no method matching randnt(::TaskLocalRNG, ::BigFloat, ::BigFloat, ::BigFloat)
The function randnt exists, but no method is defined for this combination of argument types.

Closest candidates are:
randnt(::AbstractRNG, ::Float64, ::Float64, ::Float64)

thank you.

@dtxl
Copy link
Author

dtxl commented Jan 30, 2025

In Distributions.jl/src/truncated/normal.jl the function randnt is

function randnt(rng::AbstractRNG, lb::Float64, ub::Float64, tp::Float64)
local r::Float64
...

Is there a reason for using Float64 instead of Real?
thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant