From patchwork Fri Apr 8 20:36:20 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ed Smith-Rowland <3dw4rd@verizon.net> X-Patchwork-Id: 608181 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3qhWVQ3JLxz9t4n for ; Sat, 9 Apr 2016 06:37:33 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=v3FcBXhg; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=BLdqZGps1wq2cSfFjc7M4rY0BLHzVmZ55rDlSc5eaCqcmOdMT0 zjJF88X6duPWGnqNcooTRFLCSZ4TgqU5qB/auhoOuwGG665AKtMHp9XaTu6IILLO 11TAa+/s2WP85UVa0Ni9KvQK6Ylcm1+8zqBUvLX9lvVpczTzQIw0Ym+f0= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to :from:subject:message-id:date:mime-version:content-type; s= default; bh=Y5Kl035L75QmZDfaOTxPX0U3OOE=; b=v3FcBXhg66IuOpMfgZGc xFFEXPcQHpwe09wxRnJ+FD7dQUpCK12p2NmCueqFw480yVt10iXt0gWN93msPnu2 tBuiUKTZwZlMH/5I0b4QQP0gUAnFgI+p/K9LF6imYGrsrF3MHxVD2P7G8YoA9Bcs +tJHHugQ3NqXeVMCdSD914c= Received: (qmail 96532 invoked by alias); 8 Apr 2016 20:37:24 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 96499 invoked by uid 89); 8 Apr 2016 20:37:22 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=0.2 required=5.0 tests=AWL, BAYES_50, NO_RDNS_DOTCOM_HELO, RCVD_IN_DNSWL_LOW, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.2 spammy=Electronic, lm, Beta, irene X-Spam-User: qpsmtpd, 2 recipients X-HELO: vms173023pub.verizon.net Received: from vms173023pub.verizon.net (HELO vms173023pub.verizon.net) (206.46.173.23) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Fri, 08 Apr 2016 20:37:12 +0000 Received: from vz-proxy-m003.mx.aol.com ([64.236.83.10]) by vms173023.mailsrvcs.net (Oracle Communications Messaging Server 7.0.5.32.0 64bit (built Jul 16 2014)) with ESMTPA id <0O5C00HDQ18LFO90@vms173023.mailsrvcs.net>; Fri, 08 Apr 2016 15:36:22 -0500 (CDT) X-CMAE-Score: 0 X-CMAE-Analysis: v=2.1 cv=EdU1O6SC c=1 sm=1 tr=0 a=pKq81LsWol7b8sI3Hpopew==:117 a=hTZS6uLwhHpx5LOQAS/v3KalXBI=:19 a=kziv93cY1bsA:10 a=r77TgQKjGQsHNAKrUKIA:9 a=pVbYQFakkQVIKPZwQHIA:9 a=QEXdDO2ut3YA:10 a=U9JUAQm4G5AA:10 a=o1OHuDzbAAAA:8 a=LPZBJLCeC_td05IT8QsA:9 a=sXYZbZiifVsA:10 a=FoLSdCaC-3YA:10 a=b4LDLZbEAAAA:8 a=mDV3o1hIAAAA:8 a=AIPdC31oAAAA:8 a=U1ntXoZbAAAA:8 a=PYnjg3YJAAAA:8 a=dEJNbJKXEDIeK__103IA:9 a=Ch0kvYTPxYI1iL6r:21 a=iTR2pfzJBJbwoCfO:21 a=xM6gWm99s215vdAj:21 a=NWVoK91CQyQA:10 Received: by 71.121.253.69 with SMTP id 76178f38; Fri, 08 Apr 2016 20:36:21 GMT To: "libstdc++@gcc.gnu.org" , gcc-patches , Jonathan Wakely From: Ed Smith-Rowland <3dw4rd@verizon.net> Subject: Document C++ Special Math Functions. Message-id: <57081644.3090904@verizon.net> Date: Fri, 08 Apr 2016 16:36:20 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 MIME-version: 1.0 Content-type: multipart/mixed; boundary=------------040901030905070600010708 I wanted to ship the TR29124 special math functions in libstdc++ with some documentation. More could be done but this covers the function definitions, argument ranges, template parms, and arguments. There is a little mainpage with some overview, history, biblio, and links. 2016-04-08 Edward Smith-Rowland <3dw4rd@verizon.net> Document C++19/TR29124 C++ Special Math Functions. * include/bits/specfun.h: Add Doxygen markup. Index: include/bits/specfun.h =================================================================== --- include/bits/specfun.h (revision 234525) +++ include/bits/specfun.h (working copy) @@ -75,16 +75,182 @@ * @{ */ + /** + * @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 significntly + * extended the standard trancendental functions inherited from C and declared + * in @. + * + * Although most components from TR1 were eventually adopted for C++11 these + * math function 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 folowing 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 "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 function 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 float functions to operate more quickly, + * at the cost of 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 + *