Skip to content

Commit 08e95f7

Browse files
authored
Fix promotion of arguments
1 parent 5b432fe commit 08e95f7

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/gamma_inc.jl

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -907,8 +907,12 @@ External links: [DLMF](https://dlmf.nist.gov/8.2.4), [Wikipedia](https://en.wiki
907907
908908
See also: [`gamma_inc(a,x,ind)`](@ref SpecialFunctions.gamma_inc).
909909
"""
910-
gamma_inc_inv(a::Real, p::Real, q::Real) = _gamma_inc_inv(promote(float(a), float(p), float(q))...)
910+
function gamma_inc_inv(a::Real, p::Real, q::Real)
911+
return _gamma_inc_inv(map(float, promote(a, p, q))...)
912+
end
911913

914+
# `gamma inc_inv` ensures that arguments of `_gamma_inc_inv` are
915+
# floating point numbers of the same type
912916
function _gamma_inc_inv(a::T, p::T, q::T) where {T<:Real}
913917
if p + q != 1
914918
throw(ArgumentError("p + q must equal one but is $(p + q)"))
@@ -922,7 +926,6 @@ function _gamma_inc_inv(a::T, p::T, q::T) where {T<:Real}
922926

923927
pcase = p < 0.5
924928
minpq = pcase ? p : q
925-
926929
return __gamma_inc_inv(a, minpq, pcase)
927930
end
928931

0 commit comments

Comments
 (0)