Skip to content

Commit d0ea52e

Browse files
devmotionandreasnoack
authored andcommitted
Fix promotion of arguments
(cherry picked from commit 08e95f7)
1 parent 28d7167 commit d0ea52e

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
@@ -911,8 +911,12 @@ External links: [DLMF](https://dlmf.nist.gov/8.2.4), [Wikipedia](https://en.wiki
911911
912912
See also: [`gamma_inc(a,x,ind)`](@ref SpecialFunctions.gamma_inc).
913913
"""
914-
gamma_inc_inv(a::Real, p::Real, q::Real) = _gamma_inc_inv(promote(float(a), float(p), float(q))...)
914+
function gamma_inc_inv(a::Real, p::Real, q::Real)
915+
return _gamma_inc_inv(map(float, promote(a, p, q))...)
916+
end
915917

918+
# `gamma inc_inv` ensures that arguments of `_gamma_inc_inv` are
919+
# floating point numbers of the same type
916920
function _gamma_inc_inv(a::T, p::T, q::T) where {T<:Real}
917921
if p + q != 1
918922
throw(ArgumentError("p + q must equal one but is $(p + q)"))
@@ -926,7 +930,6 @@ function _gamma_inc_inv(a::T, p::T, q::T) where {T<:Real}
926930

927931
pcase = p < 0.5
928932
minpq = pcase ? p : q
929-
930933
return __gamma_inc_inv(a, minpq, pcase)
931934
end
932935

0 commit comments

Comments
 (0)