ckormanyos/gamma_f77
implements the real-valued Gamma function
in quadruple-precision using the classic Fortran77
language.
The gamma function
For
Reflection is given by
Reccurence is given by
Let's look at some background information regarding computations of the real-valued gamma function.
The real-valued gamma function,
Consider the series expansion of the reciprocal of the gamma function near the origin
In the subroutine GAMMA
in Sect. 3.1.5 on pages 49-50 of [1],
the coefficients Fortran77
's double-precision data type REAL*8
.
Further information on this coefficient expansion can be found
in Sect. 6.1.34 of [2], in Sect. 5.7.1 of [3]
and in additional references therein.
See also Wolfram Alpha(R) for brief mathematical insight into the fascinating series expansion of the reciprocal of the gamma function near the origin.
In this repository, the series calculation mentioned above has been extended to quadruple-precision.
The coefficients Fortran77
's data type REAL*16
.
These higher-precision coefficients can be found in the table G
in the
source code.
The implementation uses the gfortran
dialect that is available in g++
.
Continuous integration (CI) runs with gfortran using GHA ubuntu-latest
and macos-latest runners. CI exercises both building gamma
as well as running
several straightforward gamma
test cases.
A (growing) test suite is present in both the build workflows
as well as in cover.sh
.
These tests are used in CI to verify the expected functionality and also
to obtain code coverage results.
The test-run computes
Negative reflection is tested at
Integral-valued argument is checked for
which is used to compute
CI runs on Ubuntu and MacOS using g++
.
Correct numerical results are verified on the OS-level
up to the grep
.
The program can also be compiled and executed at this short link to godbolt.
The program compiles with language standards legacy
(i.e., Fortran77
)
as well as all the way up to modern f2023
.
This is a remarkably long standards-conforming time-span. It exceeds 40 years - with hopefully more to come!
Proving this longevity in this repository was achieved in part through contributions from @Beliavsky. These were initially proposed in gamma_f77/issues/13. Thank you for these contributions.
[1] Shanjie Zhang and Jianming Jin, Computation of Special Functions, Wiley, 1996, ISBN: 0-471-11963-6, LC: QA351.C45
[2] M. Abramowitz and I.A. Stegun, Handbook of Mathematical Functions, 9th Printing, Dover Publications, 1970.
[3] F.W.J. Olver, D.W. Lozier, R.F. Boisvert and C.W. Clark, NIST Handbook of Mathematical Functions, Cambridge University Press, 2010.