-
Notifications
You must be signed in to change notification settings - Fork 71
Rework test suite #775
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
base: master
Are you sure you want to change the base?
Rework test suite #775
Changes from 15 commits
54a066c
5d29b56
5eadd00
80488eb
e94c6d3
72b389f
72146ce
2d8daff
f220abb
fc30cd6
8b4d2e5
1604cd6
5a27b7b
e78b289
50501eb
5f34b17
c2369e9
dd3bdcb
4abbd4b
eab4cc5
c7e3f8a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -272,7 +272,7 @@ function sample(rng::Random.AbstractRNG, x::Interval{T}) where {T<:NumTypes} | |
| β = rand(rng, float(T)) | ||
| lo = ifelse(lo == typemin(T), _value_min(T), lo) | ||
| hi = ifelse(hi == typemax(T), _value_max(T), hi) | ||
| val = convert(T, (1 - β) * lo + β * hi) | ||
| val = _value_round(T, (1 - β) * lo + β * hi) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am not sure that this is the correct fix.
Furthermore, I don't know if If we would follow the convention that julia> using Distributions
julia> u = Uniform(0//1, 1//1)
Uniform{Rational{Int64}}(a=0//1, b=1//1)
julia> typeof(rand(u))
Float64
julia> u = Uniform(0.0f0, 1f0)
Uniform{Float32}(a=0.0f0, b=1.0f0)
julia> typeof(rand(u))
Float64
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok let's output a float for either |
||
| val = ifelse(val < lo, lo, val) | ||
| val = ifelse(val > hi, hi, val) | ||
| return val | ||
|
|
@@ -284,6 +284,10 @@ _value_max(::Type{T}) where {T<:AbstractFloat} = floatmax(T) | |
| _value_min(::Type{Rational{T}}) where {T<:Integer} = convert(Rational{T}, typemin(T)) | ||
| _value_max(::Type{Rational{T}}) where {T<:Integer} = convert(Rational{T}, typemax(T)) | ||
|
|
||
| _value_round(::Type{T}, val) where {T<:AbstractFloat} = convert(T, val) | ||
| # the exact fraction of a float may overflow the integer type | ||
| _value_round(::Type{Rational{T}}, val) where {T<:Integer} = rationalize(T, val) | ||
|
|
||
| export sample | ||
|
|
||
| # | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.