-
Notifications
You must be signed in to change notification settings - Fork 100
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
Handle arguments of 1 in beta
and logabsbeta
#349
base: master
Are you sure you want to change the base?
Conversation
src/gamma.jl
Outdated
# here `T` is a floating point type but we don't want to restrict the implementation | ||
# to `AbstractFloat` or `Float64` | ||
function _beta(a::T, b::T) where {T<:Number} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How do you know that it's a floating point type then? :-) It could also be a complex.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess I was not completely precise here. What I meant was that the types are the result of calling float
(this is what I called slightly incorrectly "floating point type"), so also in the case of complex numbers it has to be Complex{T}
where T
is a floating point number.
It seems there is some problem with the MPFR library on Windows: |
The documentation of
Maybe on Windows the default precision can't handle large arguments such as |
This is an old one, but good to merge if we can - @oscardssmith? |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #349 +/- ##
==========================================
- Coverage 94.10% 92.96% -1.15%
==========================================
Files 14 12 -2
Lines 2935 2715 -220
==========================================
- Hits 2762 2524 -238
- Misses 173 191 +18
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
This PR adds special handling for arguments of 1 in
beta
andlogabsbeta
. This fixes one of the issues in JuliaStats/StatsFuns.jl#126 (I checked locally that the problem is fixed) but probably it is useful more generally (see JuliaStats/StatsFuns.jl#126 (comment) for a problem in the linked PR).Comparison (copied from JuliaStats/StatsFuns.jl#126 (comment) and JuliaStats/StatsFuns.jl#126 (comment)):
On the master branch we have
whereas with this PR one gets
The additional dispatches of
beta
that are introduced to ensure type stability also fix a bug where e.g.beta(::BigInt, ::BigFloat)
did not use and differed from the MPFR implementation.