hyper_2f1, a Fortran90 code which evaluates the hypergeometric functions 2F1(a,b,c;x) for real or complex parameters a, b, c, and argument x, by N. Michel and M. Stoitsov.

Although this code should get 16 digits of accuracy, it seems, at least for complex results, to be limited to 8 digits instead. The corresponding C++ version has no such accuracy issue, so some kind of hidden bug is suspected.


The computer code and data files made available on this web page are distributed under the MIT license.


hyper_2f1 is available in a F90 version and a C++ version and a MATLAB version and a Python version.

Related Data and Programs:


test_values, a Fortran90 code which supplies test values of various mathematical functions, including Abramowitz, AGM, Airy, Bell, Bernoulli, Bessel, Beta, Binomial, Bivariate Normal, Catalan, Cauchy, Chebyshev, Chi Square, Clausen, Clebsch Gordan, Collatz, Cosine integral, Dawson, Debye, Dedekind, dilogarithm, Exponential integral, Elliptic, Error, Euler, Exponential integral, F probability, Fresnel, Frobenius, Gamma, Gegenbauer, Goodwin, Gudermannian, Harmonic, Hermite, Hypergeometric 1F1, Hypergeometric 2F1, inverse trigonometic, Jacobi, Julian Ephemeris Date, Kelvin, Laguerre, Lambert W, Laplace, Legendre, Lerch, Lobachevsky, Lobatto, Logarithmic integral, Log normal, McNugget numbers, Mertens, Mittag-Leffler, Moebius, Multinomial, Negative binomial, Nine J, Normal, Omega, Owen, Partition, Phi, Pi, Poisson, Polylogarithm, Polyomino, Prime, Psi, Rayleigh, Hyperbolic Sine integral, Sigma, Sine Power integral, Sine integral, Six J, Sphere area, Sphere volume, Spherical harmonic, Stirling, Stromgen, Struve, Student, Subfactorial, Student probability, Three J, Transport, Trigamma, Truncated normal, van der Corput, von Mises, Weibull, Wright omega, Zeta.


  1. N. Michel, M. Stoitsov,
    Fast computation of the Gauss hypergeometric function with all its parameters complex with application to the Poeschl-Teller-Ginocchio potential wave functions,
    Computer Physics Communications,
    Volume 178, 1 August 2007, pages 535-551.
  2. Olde Daalhuis, Adri B. (2010),
    "Hypergeometric function",
    in Olver, Frank W. J.; Lozier, Daniel M.; Boisvert, Ronald F.
    Clark, Charles W. (eds.),
    NIST Handbook of Mathematical Functions,
    Cambridge University Press, ISBN 978-0-521-19225-5.

Source Code:

Last revised on 24 December 2023.