From 3f94f34c6b56b22d3ef3e84ed2aa163b11a62459 Mon Sep 17 00:00:00 2001 From: emsr Date: Tue, 12 Apr 2016 16:31:25 +0000 Subject: [PATCH] 2016-04-12 Edward Smith-Rowland <3dw4rd@verizon.net> Document C++17/TR29124 C++ Special Math Functions. * include/bits/specfun.h: Add Doxygen markup. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@234905 138bc75d-0d04-0410-961f-82ee72b054a4 --- libstdc++-v3/ChangeLog | 5 + libstdc++-v3/include/bits/specfun.h | 846 +++++++++++++++++++++++++++++++++++- 2 files changed, 833 insertions(+), 18 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 48a13fa90a6..4fb711b35d8 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,8 @@ +2016-04-12 Edward Smith-Rowland <3dw4rd@verizon.net> + + Document C++17/TR29124 C++ Special Math Functions. + * include/bits/specfun.h: Add Doxygen markup. + 2016-04-07 Jonathan Wakely * testsuite/30_threads/thread/70503.cc: Adjust from xfail to pass. diff --git a/libstdc++-v3/include/bits/specfun.h b/libstdc++-v3/include/bits/specfun.h index 28c9d30e5be..77bbda36fd8 100644 --- a/libstdc++-v3/include/bits/specfun.h +++ b/libstdc++-v3/include/bits/specfun.h @@ -1,6 +1,6 @@ // Mathematical Special Functions for -*- C++ -*- -// Copyright (C) 2006-2015 Free Software Foundation, Inc. +// Copyright (C) 2006-2016 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 @@ -34,12 +34,14 @@ #include +#define __STDCPP_MATH_SPEC_FUNCS__ 201003L + +#define __cpp_lib_math_special_functions 201603L + #if __STDCPP_WANT_MATH_SPEC_FUNCS__ == 0 # error include and define __STDCPP_WANT_MATH_SPEC_FUNCS__ #endif -#define __STDCPP_MATH_SPEC_FUNCS__ 201003L - #include #include #include @@ -69,16 +71,182 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION * @{ */ + /** + * @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 conf_hyperg "conf_hyperg - Confluent hypergeometric functions" + * - @ref 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 opint 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 + *