Skip to content

Commit 541fa23

Browse files
authored
Merge pull request #4 from TSGut/main
Implement loggamma
2 parents a6ae907 + 3c1b159 commit 541fa23

File tree

6 files changed

+661
-10
lines changed

6 files changed

+661
-10
lines changed

README.md

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,13 @@
44

55
Simple and fast Gamma function.
66

7-
This library provides an implimentation of the [Gamma function](https://en.wikipedia.org/wiki/Gamma_function).
7+
This library provides a dependence-free, Julia native implementation of the [Gamma function](https://en.wikipedia.org/wiki/Gamma_function) and related utilities like `loggamma` and `logabsgamma`.
88

9-
This library is very simple with no dependencies and a single exported function: `gamma`
10-
11-
Supports `Integer`, `Float16`, `Float32`, and `Float64` arguments.
12-
13-
Support for `Complex` numbers, `BigFloats` and `loggamma` comming soon.
9+
Supports `Integer`, `Float16`, `Float32`, and `Float64`, `Complex` and `BigFloat` arguments.
1410

1511
## Contributing
1612

1713
Contributions are very welcome, as are feature requests, suggestions or general discussions.
1814
Please open an issue for discussion on newer implementations, share papers, new features, or if you encounter any problems.
19-
Our goal is to provide high quality implementations of Bessel functions that match or exceed the accuracy of the implementations provided by SpecialFunctions.jl.
15+
Our goal is to provide high quality Julia native implementations of Gamma functions that match or exceed the accuracy of the implementations provided by SpecialFunctions.jl.
2016
Please let us know if you encounter any accuracy or performance issues.

src/Gamma.jl

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
module Gamma
22

3-
include("gamma.jl")
4-
include("precompile.jl")
3+
include("gamma_implementation.jl")
4+
include("precompile.jl")
5+
include("loggamma.jl")
56

6-
export gamma
7+
export gamma, loggamma, logabsgamma, logfactorial
78

89
end

src/gamma.jl renamed to src/gamma_implementation.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,3 +125,6 @@ function gamma(n::Integer)
125125
end
126126

127127
gamma_near_1(x) = evalpoly(x-one(x), (1.0, -0.5772156649015329, 0.9890559953279725, -0.23263776388631713))
128+
129+
gamma(x::BigFloat) = exp(loggamma(x))
130+
gamma(x::Complex) = exp(loggamma(x))

0 commit comments

Comments
 (0)