Skip to content

Commit

Permalink
Change fallback unsafe_gamma for x::Real to x<:AbstractFloat. Add (#28)
Browse files Browse the repository at this point in the history
* Change fallback unsafe_gamma for x::Real to x<:AbstractFloat. Add
fallback for generic argument to default gamma function.

* Remove unnecessary float conversion.

* Final cleanup to unsafe_gamma. Bump version.

* Remove commented line. Sorry for hasty push earlier.

Co-authored-by: Chris Geoga <{ID}+{username}@users.noreply.github.com>
  • Loading branch information
cgeoga and Chris Geoga authored Aug 9, 2020
1 parent 720e95d commit f4461b4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "HypergeometricFunctions"
uuid = "34004b35-14d8-5ef3-9330-4cdb6864b03a"
version = "0.3.1"
version = "0.3.2"

[deps]
DualNumbers = "fa6b7ba4-c1ee-5f82-b5fc-ecf0adba8f74"
Expand Down
4 changes: 1 addition & 3 deletions src/specialfunctions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -141,15 +141,13 @@ const libm = Base.libm_name

unsafe_gamma(x::Float64) = ccall((:tgamma, libm), Float64, (Float64, ), x)
unsafe_gamma(x::Float32) = ccall((:tgammaf, libm), Float32, (Float32, ), x)
unsafe_gamma(x::Real) = unsafe_gamma(float(x))
function unsafe_gamma(x::BigFloat)
z = BigFloat()
ccall((:mpfr_gamma, :libmpfr), Int32, (Ref{BigFloat}, Ref{BigFloat}, Int32), z, x, Base.MPFR.ROUNDING_MODE[])
return z
end
unsafe_gamma(z::Complex) = gamma(z)
unsafe_gamma(z::Dual) = (r = realpart(z);w = unsafe_gamma(r); dual(w, w*digamma(r)*dualpart(z)))

unsafe_gamma(z) = gamma(z)
"""
@lanczosratio(z, ϵ, c₀, c...)
Expand Down

2 comments on commit f4461b4

@MikaelSlevinsky
Copy link
Collaborator

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/19240

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 v0.3.2 -m "<description of version>" f4461b4e2bb7533012c7e8fb39171e106628e1d4
git push origin v0.3.2

Please sign in to comment.