Skip to content

Commit

Permalink
Fix beta_inc_inv bug introduced in #399 (#401)
Browse files Browse the repository at this point in the history
  • Loading branch information
devmotion committed Jun 1, 2022
1 parent 7461b51 commit 49be7e6
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "SpecialFunctions"
uuid = "276daf66-3868-5448-9aa4-cd146d93841b"
version = "2.1.5"
version = "2.1.6"

[deps]
ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4"
Expand Down
2 changes: 1 addition & 1 deletion src/beta_inc.jl
Original file line number Diff line number Diff line change
Expand Up @@ -967,7 +967,7 @@ function _beta_inc_inv(a::Float64, b::Float64, p::Float64, q::Float64=1-p)
sq = 1.0
prev = 1.0

x = clamp(x, fpu, prevfloat(1.0))
x = clamp(x, 0.0001, 0.9999)

# This first argument was proposed in
#
Expand Down
6 changes: 6 additions & 0 deletions test/beta_inc.jl
Original file line number Diff line number Diff line change
Expand Up @@ -305,4 +305,10 @@ end
y = 2.0e-280
@test beta_inc(2.0, 1.0, beta_inc_inv(2.0, 1.0, y, 1.0)[1])[1] y
end

@testset "StatsFuns#145" begin
y = 0.92
@test beta_inc_inv(0.01, 0.1, y)[1] 0.7803014210919872
@test beta_inc(0.01, 0.1, beta_inc_inv(0.01, 0.1, y)[1])[1] y
end
end

2 comments on commit 49be7e6

@devmotion
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/61528

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v2.1.6 -m "<description of version>" 49be7e6add22057776b5ed8ae32e0dae84500203
git push origin v2.1.6

Please sign in to comment.