// Mathematical Special Functions for -*- C++ -*- // Copyright (C) 2006-2019 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the // terms of the GNU General Public License as published by the // Free Software Foundation; either version 3, or (at your option) // any later version. // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // . /** @file bits/specfun.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{cmath} */ #ifndef _GLIBCXX_BITS_SPECFUN_H #define _GLIBCXX_BITS_SPECFUN_H 1 #pragma GCC visibility push(default) #include #define __STDCPP_MATH_SPEC_FUNCS__ 201003L #define __cpp_lib_math_special_functions 201603L #if __cplusplus <= 201403L && __STDCPP_WANT_MATH_SPEC_FUNCS__ == 0 # error include and define __STDCPP_WANT_MATH_SPEC_FUNCS__ #endif #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION /** * @defgroup mathsf Mathematical Special Functions * @ingroup numerics * * A collection of advanced mathematical special functions, * defined by ISO/IEC IS 29124. * @{ */ /** * @mainpage Mathematical Special Functions * * @section intro Introduction and History * The first significant library upgrade on the road to C++2011, * * TR1, included a set of 23 mathematical functions that significantly * extended the standard transcendental functions inherited from C and declared * in @. * * Although most components from TR1 were eventually adopted for C++11 these * math functions were left behind out of concern for implementability. * The math functions were published as a separate international standard * * IS 29124 - Extensions to the C++ Library to Support Mathematical Special * Functions. * * For C++17 these functions were incorporated into the main standard. * * @section contents Contents * The following functions are implemented in namespace @c std: * - @ref assoc_laguerre "assoc_laguerre - Associated Laguerre functions" * - @ref assoc_legendre "assoc_legendre - Associated Legendre functions" * - @ref beta "beta - Beta functions" * - @ref comp_ellint_1 "comp_ellint_1 - Complete elliptic functions of the first kind" * - @ref comp_ellint_2 "comp_ellint_2 - Complete elliptic functions of the second kind" * - @ref comp_ellint_3 "comp_ellint_3 - Complete elliptic functions of the third kind" * - @ref cyl_bessel_i "cyl_bessel_i - Regular modified cylindrical Bessel functions" * - @ref cyl_bessel_j "cyl_bessel_j - Cylindrical Bessel functions of the first kind" * - @ref cyl_bessel_k "cyl_bessel_k - Irregular modified cylindrical Bessel functions" * - @ref cyl_neumann "cyl_neumann - Cylindrical Neumann functions or Cylindrical Bessel functions of the second kind" * - @ref ellint_1 "ellint_1 - Incomplete elliptic functions of the first kind" * - @ref ellint_2 "ellint_2 - Incomplete elliptic functions of the second kind" * - @ref ellint_3 "ellint_3 - Incomplete elliptic functions of the third kind" * - @ref expint "expint - The exponential integral" * - @ref hermite "hermite - Hermite polynomials" * - @ref laguerre "laguerre - Laguerre functions" * - @ref legendre "legendre - Legendre polynomials" * - @ref riemann_zeta "riemann_zeta - The Riemann zeta function" * - @ref sph_bessel "sph_bessel - Spherical Bessel functions" * - @ref sph_legendre "sph_legendre - Spherical Legendre functions" * - @ref sph_neumann "sph_neumann - Spherical Neumann functions" * * The hypergeometric functions were stricken from the TR29124 and C++17 * versions of this math library because of implementation concerns. * However, since they were in the TR1 version and since they are popular * we kept them as an extension in namespace @c __gnu_cxx: * - @ref __gnu_cxx::conf_hyperg "conf_hyperg - Confluent hypergeometric functions" * - @ref __gnu_cxx::hyperg "hyperg - Hypergeometric functions" * * @section general General Features * * @subsection promotion Argument Promotion * The arguments suppled to the non-suffixed functions will be promoted * according to the following rules: * 1. If any argument intended to be floating point is given an integral value * That integral value is promoted to double. * 2. All floating point arguments are promoted up to the largest floating * point precision among them. * * @subsection NaN NaN Arguments * If any of the floating point arguments supplied to these functions is * invalid or NaN (std::numeric_limits::quiet_NaN), * the value NaN is returned. * * @section impl Implementation * * We strive to implement the underlying math with type generic algorithms * to the greatest extent possible. In practice, the functions are thin * wrappers that dispatch to function templates. Type dependence is * controlled with std::numeric_limits and functions thereof. * * We don't promote @c float to @c double or @c double to long double * reflexively. The goal is for @c float functions to operate more quickly, * at the cost of @c float accuracy and possibly a smaller domain of validity. * Similaryly, long double should give you more dynamic range * and slightly more pecision than @c double on many systems. * * @section testing Testing * * These functions have been tested against equivalent implementations * from the * Gnu Scientific Library, GSL and *