This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[libstdc++] Expose Airy functions.


We've had these Airy functions almost to the surface for a while now.

Let's have them as extensions.

This is undergoing testing now.

OK if testing passes?



Attachment: airy.CL
Description: Text document

diff --git a/libstdc++-v3/include/bits/specfun.h b/libstdc++-v3/include/bits/specfun.h
index 6bb3ec0..45449fe 100644
--- a/libstdc++-v3/include/bits/specfun.h
+++ b/libstdc++-v3/include/bits/specfun.h
@@ -1206,6 +1206,100 @@ namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
 {
 _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
+  // Airy functions
+
+  /**
+   * Return the Airy function @f$ Ai(x) @f$ of @c float argument x.
+   */
+  inline float
+  airy_aif(float __x)
+  {
+    float __Ai, __Bi, __Aip, __Bip;
+    std::__detail::__airy<float>(__x, __Ai, __Bi, __Aip, __Bip);
+    return __Ai;
+  }
+
+  /**
+   * Return the Airy function @f$ Ai(x) @f$ of @c double argument x.
+   */
+  inline double
+  airy_ai(double __x)
+  {
+    double __Ai, __Bi, __Aip, __Bip;
+    std::__detail::__airy<double>(__x, __Ai, __Bi, __Aip, __Bip);
+    return __Ai;
+  }
+
+  /**
+   * Return the Airy function @f$ Ai(x) @f$ of <tt>long double</tt> argument x.
+   */
+  inline long double
+  airy_ail(long double __x)
+  {
+    long double __Ai, __Bi, __Aip, __Bip;
+    std::__detail::__airy<long double>(__x, __Ai, __Bi, __Aip, __Bip);
+    return __Ai;
+  }
+
+  /**
+   * Return the Airy function @f$ Ai(x) @f$ of real argument x.
+   */
+  template<typename _Tp>
+    inline typename __gnu_cxx::__promote<_Tp>::__type
+    airy_ai(__x)
+    {
+      typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+      __type __Ai, __Bi, __Aip, __Bip;
+      std::__detail::__airy<__type>(__x, __Ai, __Bi, __Aip, __Bip);
+      return __Ai;
+    }
+
+  /**
+   * Return the Airy function @f$ Bi(x) @f$ of @c float argument x.
+   */
+  inline float
+  airy_bif(float __x)
+  {
+    float __Ai, __Bi, __Aip, __Bip;
+    std::__detail::__airy<float>(__x, __Ai, __Bi, __Aip, __Bip);
+    return __Bi;
+  }
+
+  /**
+   * Return the Airy function @f$ Bi(x) @f$ of @c double argument x.
+   */
+  inline double
+  airy_bi(double __x)
+  {
+    double __Ai, __Bi, __Aip, __Bip;
+    std::__detail::__airy<double>(__x, __Ai, __Bi, __Aip, __Bip);
+    return __Bi;
+  }
+
+  /**
+   * Return the Airy function @f$ Bi(x) @f$ of <tt>long double</tt> argument x.
+   */
+  inline long double
+  airy_bil(long double __x)
+  {
+    long double __Ai, __Bi, __Aip, __Bip;
+    std::__detail::__airy<long double>(__x, __Ai, __Bi, __Aip, __Bip);
+    return __Bi;
+  }
+
+  /**
+   * Return the Airy function @f$ Bi(x) @f$ of real argument x.
+   */
+  template<typename _Tp>
+    inline typename __gnu_cxx::__promote<_Tp>::__type
+    airy_bi(_Tp __x)
+    {
+      typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
+      __type __Ai, __Bi, __Aip, __Bip;
+      std::__detail::__airy<__type>(__x, __Ai, __Bi, __Aip, __Bip);
+      return __Bi;
+    }
+
   // Confluent hypergeometric functions
 
   /**
diff --git a/libstdc++-v3/include/tr1/modified_bessel_func.tcc b/libstdc++-v3/include/tr1/modified_bessel_func.tcc
index 79d7d75..3a8ee01 100644
--- a/libstdc++-v3/include/tr1/modified_bessel_func.tcc
+++ b/libstdc++-v3/include/tr1/modified_bessel_func.tcc
@@ -377,8 +377,19 @@ namespace tr1
       const _Tp __absx = std::abs(__x);
       const _Tp __rootx = std::sqrt(__absx);
       const _Tp __z = _Tp(2) * __absx * __rootx / _Tp(3);
+      const _Tp _S_NaN = std::numeric_limits<_Tp>::quiet_NaN();
+      const _Tp _S_inf = std::numeric_limits<_Tp>::infinity();
 
-      if (__x > _Tp(0))
+      if (__isnan(__x))
+        __Bip = __Aip = __Bi = __Ai = std::numeric_limits<_Tp>::quiet_NaN();
+      else if (__z == _S_inf)
+        {
+	  __Aip = __Ai = _Tp{0};
+	  __Bip = __Bi = _S_inf;
+	}
+      else if (__z == -_S_inf)
+	__Bip = __Aip = __Bi = __Ai = _Tp{0}};
+      else if (__x > _Tp(0))
         {
           _Tp __I_nu, __Ip_nu, __K_nu, __Kp_nu;
 
diff --git a/libstdc++-v3/testsuite/ext/special_functions/airy_ai/check_nan.cc b/libstdc++-v3/testsuite/ext/special_functions/airy_ai/check_nan.cc
new file mode 100644
index 0000000..810be17
--- /dev/null
+++ b/libstdc++-v3/testsuite/ext/special_functions/airy_ai/check_nan.cc
@@ -0,0 +1,198 @@
+
+
+
+
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
+<html xmlns="http://www.w3.org/1999/xhtml"; xml:lang="en" lang="en">
+<!-- ViewVC :: http://www.viewvc.org/ -->
+<head>
+<title>[gcc] Log of /branches/tr29124/libstdc++-v3/testsuite/ext/special_functions/airy_ai/check_nan.cc</title>
+<meta name="generator" content="ViewVC 1.1.26" />
+<link rel="shortcut icon" href="/viewvc-static/images/favicon.ico" />
+<link rel="stylesheet" href="/viewvc-static/styles.css" type="text/css" />
+
+</head>
+<body>
+<div class="vc_navheader">
+<table><tr>
+<td><strong><a href="/viewcvs?sortby=date"><span class="pathdiv">/</span></a><a href="/viewcvs/gcc/?sortby=date">[gcc]</a><span class="pathdiv">/</span><a href="/viewcvs/gcc/branches/?sortby=date">branches</a><span class="pathdiv">/</span><a href="/viewcvs/gcc/branches/tr29124/?sortby=date">tr29124</a><span class="pathdiv">/</span><a href="/viewcvs/gcc/branches/tr29124/libstdc%2B%2B-v3/?sortby=date">libstdc++-v3</a><span class="pathdiv">/</span><a href="/viewcvs/gcc/branches/tr29124/libstdc%2B%2B-v3/testsuite/?sortby=date">testsuite</a><span class="pathdiv">/</span><a href="/viewcvs/gcc/branches/tr29124/libstdc%2B%2B-v3/testsuite/ext/?sortby=date">ext</a><span class="pathdiv">/</span><a href="/viewcvs/gcc/branches/tr29124/libstdc%2B%2B-v3/testsuite/ext/special_functions/?sortby=date">special_functions</a><span class="pathdiv">/</span><a href="/viewcvs/gcc/branches/tr29124/libstdc%2B%2B-v3/testsuite/ext/special_functions/airy_ai/?sortby=date">airy_ai</a><span class="pathdiv">/</span>check_nan.cc</strong></td>
+<td style="text-align: right;"></td>
+</tr></table>
+</div>
+<div style="float: right; padding: 5px;"><a href="http://www.viewvc.org/"; title="ViewVC Home"><img src="/viewvc-static/images/viewvc-logo.png" alt="ViewVC logotype" width="240" height="70" /></a></div>
+<h1>Log of /branches/tr29124/libstdc++-v3/testsuite/ext/special_functions/airy_ai/check_nan.cc</h1>
+
+<p style="margin:0;">
+
+<a href="/viewcvs/gcc/branches/tr29124/libstdc%2B%2B-v3/testsuite/ext/special_functions/airy_ai/?sortby=date"><img src="/viewvc-static/images/back_small.png" class="vc_icon" alt="Parent Directory" /> Parent Directory</a>
+
+| <a href="/viewcvs/gcc/branches/tr29124/libstdc%2B%2B-v3/testsuite/ext/special_functions/airy_ai/check_nan.cc?sortby=date&amp;view=log"><img src="/viewvc-static/images/log.png" class="vc_icon" alt="Revision Log" /> Revision Log</a>
+
+
+
+
+</p>
+
+<hr />
+<table class="auto">
+
+
+
+<tr>
+<td>Links to HEAD:</td>
+<td>
+(<a href="/viewcvs/gcc/branches/tr29124/libstdc%2B%2B-v3/testsuite/ext/special_functions/airy_ai/check_nan.cc?view=markup&amp;sortby=date">view</a>)
+(<a href="/viewcvs/gcc/branches/tr29124/libstdc%2B%2B-v3/testsuite/ext/special_functions/airy_ai/check_nan.cc?view=co">download</a>)
+(<a href="/viewcvs/gcc/branches/tr29124/libstdc%2B%2B-v3/testsuite/ext/special_functions/airy_ai/check_nan.cc?view=co&amp;content-type=text%2Fplain">as text</a>)
+(<a href="/viewcvs/gcc/branches/tr29124/libstdc%2B%2B-v3/testsuite/ext/special_functions/airy_ai/check_nan.cc?view=annotate&amp;sortby=date">annotate</a>)
+</td>
+</tr>
+
+
+
+<tr>
+<td>Sticky Revision:</td>
+<td><form method="get" action="/viewcvs/gcc" style="display: inline">
+<div style="display: inline">
+<input type="hidden" name="orig_pathtype" value="FILE"/><input type="hidden" name="orig_view" value="log"/><input type="hidden" name="orig_path" value="branches/tr29124/libstdc++-v3/testsuite/ext/special_functions/airy_ai/check_nan.cc"/><input type="hidden" name="sortby" value="date"/><input type="hidden" name="view" value="redirect_pathrev"/>
+
+<input type="text" name="pathrev" value="" size="6"/>
+
+<input type="submit" value="Set" />
+</div>
+</form>
+
+</td>
+</tr>
+</table>
+ 
+
+
+
+
+
+
+
+
+
+<div>
+<hr />
+
+<a name="rev246919"></a>
+
+
+Revision <a href="/viewcvs/gcc?view=revision&amp;sortby=date&amp;revision=246919"><strong>246919</strong></a> -
+
+
+(<a href="/viewcvs/gcc/branches/tr29124/libstdc%2B%2B-v3/testsuite/ext/special_functions/airy_ai/check_nan.cc?revision=246919&amp;view=markup&amp;sortby=date">view</a>)
+
+
+(<a href="/viewcvs/gcc/branches/tr29124/libstdc%2B%2B-v3/testsuite/ext/special_functions/airy_ai/check_nan.cc?revision=246919&amp;view=co">download</a>)
+(<a href="/viewcvs/gcc/branches/tr29124/libstdc%2B%2B-v3/testsuite/ext/special_functions/airy_ai/check_nan.cc?view=co&amp;revision=246919&amp;content-type=text%2Fplain">as text</a>)
+(<a href="/viewcvs/gcc/branches/tr29124/libstdc%2B%2B-v3/testsuite/ext/special_functions/airy_ai/check_nan.cc?annotate=246919&amp;sortby=date">annotate</a>)
+
+
+
+- <a href="/viewcvs/gcc/branches/tr29124/libstdc%2B%2B-v3/testsuite/ext/special_functions/airy_ai/check_nan.cc?sortby=date&amp;view=log&amp;r1=246919&amp;log_pagestart=0">[select for diffs]</a>
+
+
+
+
+<br />
+
+Added
+
+<em>Thu Apr 13 20:26:52 2017 UTC</em>
+(6 months, 3 weeks ago)
+by <em>emsr</em>
+
+
+
+
+
+
+
+<br />File length: 1535 byte(s)
+
+
+
+
+
+
+
+
+
+
+
+<pre class="vc_log">Merged revisions through <a href="/viewcvs/gcc?view=revision&amp;sortby=date&amp;revision=246916">r246916</a> to the branch
+</pre>
+</div>
+
+ 
+
+
+
+
+ <hr />
+<p><a name="diff"></a>
+This form allows you to request diffs between any two revisions of this file.
+For each of the two "sides" of the diff,
+
+enter a numeric revision.
+
+</p>
+<form method="get" action="/viewcvs/gcc/branches/tr29124/libstdc%2B%2B-v3/testsuite/ext/special_functions/airy_ai/check_nan.cc" id="diff_select">
+<table cellpadding="2" cellspacing="0" class="auto">
+<tr>
+<td>&nbsp;</td>
+<td>
+<input type="hidden" name="sortby" value="date"/><input type="hidden" name="view" value="diff"/>
+Diffs between
+
+<input type="text" size="12" name="r1"
+value="246919" />
+
+and
+
+<input type="text" size="12" name="r2" value="246919" />
+
+</td>
+</tr>
+<tr>
+<td>&nbsp;</td>
+<td>
+Type of Diff should be a
+<select name="diff_format" onchange="submit()">
+<option value="h" selected="selected">Colored Diff</option>
+<option value="l" >Long Colored Diff</option>
+<option value="f" >Full Colored Diff</option>
+<option value="u" >Unidiff</option>
+<option value="c" >Context Diff</option>
+<option value="s" >Side by Side</option>
+</select>
+<input type="submit" value=" Get Diffs " />
+</td>
+</tr>
+</table>
+</form>
+
+
+
+
+
+<hr />
+<table>
+<tr>
+<td>&nbsp;</td>
+<td style="text-align: right;"><strong><a href="/viewvc-static/help_log.html">ViewVC Help</a></strong></td>
+</tr>
+<tr>
+<td>Powered by <a href="http://viewvc.tigris.org/";>ViewVC 1.1.26</a></td>
+<td style="text-align: right;">&nbsp;</td>
+</tr>
+</table>
+</body>
+</html>
+
+
diff --git a/libstdc++-v3/testsuite/ext/special_functions/airy_ai/check_value.cc b/libstdc++-v3/testsuite/ext/special_functions/airy_ai/check_value.cc
new file mode 100644
index 0000000..10f2f7c
--- /dev/null
+++ b/libstdc++-v3/testsuite/ext/special_functions/airy_ai/check_value.cc
@@ -0,0 +1,126 @@
+// { dg-do run { target c++11 } }
+// { dg-options "-D__STDCPP_WANT_MATH_SPEC_FUNCS__" }
+//
+// Copyright (C) 2016-2017 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.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3.  If not see
+// <http://www.gnu.org/licenses/>.
+
+//  airy_ai
+
+//  Compare against values generated by the GNU Scientific Library.
+//  The GSL can be found on the web: http://www.gnu.org/software/gsl/
+#include <limits>
+#include <cmath>
+#if defined(__TEST_DEBUG)
+#  include <iostream>
+#  define VERIFY(A) \
+  if (!(A)) \
+    { \
+      std::cout << "line " << __LINE__ \
+	<< "  max_abs_frac = " << max_abs_frac \
+	<< std::endl; \
+    }
+#else
+#  include <testsuite_hooks.h>
+#endif
+#include <specfun_testcase.h>
+
+// Test data.
+// max(|f - f_GSL|): 2.0261570199409107e-15 at index 0
+// max(|f - f_GSL| / |f_GSL|): 5.7527019513802774e-14
+// mean(f - f_GSL): 5.7893945880945940e-17
+// variance(f - f_GSL): 8.5887539970087062e-35
+// stddev(f - f_GSL): 9.2675530734971811e-18
+const testcase_airy_ai<double>
+data001[41] =
+{
+  { 0.040241238486444071, -10.000000000000000, 0.0 },
+  { 0.31910324771912801, -9.5000000000000000, 0.0 },
+  { -0.022133721547341240, -9.0000000000000000, 0.0 },
+  { -0.33029023763020882, -8.5000000000000000, 0.0 },
+  { -0.052705050356385910, -8.0000000000000000, 0.0 },
+  { 0.32177571638064789, -7.5000000000000000, 0.0 },
+  { 0.18428083525050609, -7.0000000000000000, 0.0 },
+  { -0.23802030199711663, -6.5000000000000000, 0.0 },
+  { -0.32914517362982321, -6.0000000000000000, 0.0 },
+  { 0.017781541276574383, -5.5000000000000000, 0.0 },
+  { 0.35076100902411411, -5.0000000000000000, 0.0 },
+  { 0.29215278105595921, -4.5000000000000000, 0.0 },
+  { -0.070265532949289680, -4.0000000000000000, 0.0 },
+  { -0.37553382314043182, -3.5000000000000000, 0.0 },
+  { -0.37881429367765823, -3.0000000000000000, 0.0 },
+  { -0.11232506769296607, -2.5000000000000000, 0.0 },
+  { 0.22740742820168561, -2.0000000000000000, 0.0 },
+  { 0.46425657774886947, -1.5000000000000000, 0.0 },
+  { 0.53556088329235207, -1.0000000000000000, 0.0 },
+  { 0.47572809161053958, -0.50000000000000000, 0.0 },
+  { 0.35502805388781722, 0.0000000000000000, 0.0 },
+  { 0.23169360648083348, 0.50000000000000000, 0.0 },
+  { 0.13529241631288141, 1.0000000000000000, 0.0 },
+  { 0.071749497008105428, 1.5000000000000000, 0.0 },
+  { 0.034924130423274372, 2.0000000000000000, 0.0 },
+  { 0.015725923380470481, 2.5000000000000000, 0.0 },
+  { 0.0065911393574607175, 3.0000000000000000, 0.0 },
+  { 0.0025840987869896349, 3.5000000000000000, 0.0 },
+  { 0.00095156385120480195, 4.0000000000000000, 0.0 },
+  { 0.00033025032351430934, 4.5000000000000000, 0.0 },
+  { 0.00010834442813607434, 5.0000000000000000, 0.0 },
+  { 3.3685311908599812e-05, 5.5000000000000000, 0.0 },
+  { 9.9476943602528973e-06, 6.0000000000000000, 0.0 },
+  { 2.7958823432049148e-06, 6.5000000000000000, 0.0 },
+  { 7.4921288639971570e-07, 7.0000000000000000, 0.0 },
+  { 1.9172560675134295e-07, 7.5000000000000000, 0.0 },
+  { 4.6922076160992236e-08, 8.0000000000000000, 0.0 },
+  { 1.0997009755195515e-08, 8.5000000000000000, 0.0 },
+  { 2.4711684308724904e-09, 9.0000000000000000, 0.0 },
+  { 5.3302637046174900e-10, 9.5000000000000000, 0.0 },
+  { 1.1047532552898652e-10, 10.000000000000000, 0.0 },
+};
+const double toler001 = 5.0000000000000029e-12;
+
+template<typename Ret, unsigned int Num>
+  void
+  test(const testcase_airy_ai<Ret> (&data)[Num], Ret toler)
+  {
+    bool test __attribute__((unused)) = true;
+    const Ret eps = std::numeric_limits<Ret>::epsilon();
+    Ret max_abs_diff = -Ret(1);
+    Ret max_abs_frac = -Ret(1);
+    unsigned int num_datum = Num;
+    for (unsigned int i = 0; i < num_datum; ++i)
+      {
+	const Ret f = __gnu_cxx::airy_ai(data[i].x);
+	const Ret f0 = data[i].f0;
+	const Ret diff = f - f0;
+	if (std::abs(diff) > max_abs_diff)
+	  max_abs_diff = std::abs(diff);
+	if (std::abs(f0) > Ret(10) * eps
+	 && std::abs(f) > Ret(10) * eps)
+	  {
+	    const Ret frac = diff / f0;
+	    if (std::abs(frac) > max_abs_frac)
+	      max_abs_frac = std::abs(frac);
+	  }
+      }
+    VERIFY(max_abs_frac < toler);
+  }
+
+int
+main()
+{
+  test(data001, toler001);
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/ext/special_functions/airy_ai/compile.cc b/libstdc++-v3/testsuite/ext/special_functions/airy_ai/compile.cc
new file mode 100644
index 0000000..de15243
--- /dev/null
+++ b/libstdc++-v3/testsuite/ext/special_functions/airy_ai/compile.cc
@@ -0,0 +1,198 @@
+
+
+
+
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
+<html xmlns="http://www.w3.org/1999/xhtml"; xml:lang="en" lang="en">
+<!-- ViewVC :: http://www.viewvc.org/ -->
+<head>
+<title>[gcc] Log of /branches/tr29124/libstdc++-v3/testsuite/ext/special_functions/airy_ai/compile.cc</title>
+<meta name="generator" content="ViewVC 1.1.26" />
+<link rel="shortcut icon" href="/viewvc-static/images/favicon.ico" />
+<link rel="stylesheet" href="/viewvc-static/styles.css" type="text/css" />
+
+</head>
+<body>
+<div class="vc_navheader">
+<table><tr>
+<td><strong><a href="/viewcvs?sortby=date"><span class="pathdiv">/</span></a><a href="/viewcvs/gcc/?sortby=date">[gcc]</a><span class="pathdiv">/</span><a href="/viewcvs/gcc/branches/?sortby=date">branches</a><span class="pathdiv">/</span><a href="/viewcvs/gcc/branches/tr29124/?sortby=date">tr29124</a><span class="pathdiv">/</span><a href="/viewcvs/gcc/branches/tr29124/libstdc%2B%2B-v3/?sortby=date">libstdc++-v3</a><span class="pathdiv">/</span><a href="/viewcvs/gcc/branches/tr29124/libstdc%2B%2B-v3/testsuite/?sortby=date">testsuite</a><span class="pathdiv">/</span><a href="/viewcvs/gcc/branches/tr29124/libstdc%2B%2B-v3/testsuite/ext/?sortby=date">ext</a><span class="pathdiv">/</span><a href="/viewcvs/gcc/branches/tr29124/libstdc%2B%2B-v3/testsuite/ext/special_functions/?sortby=date">special_functions</a><span class="pathdiv">/</span><a href="/viewcvs/gcc/branches/tr29124/libstdc%2B%2B-v3/testsuite/ext/special_functions/airy_ai/?sortby=date">airy_ai</a><span class="pathdiv">/</span>compile.cc</strong></td>
+<td style="text-align: right;"></td>
+</tr></table>
+</div>
+<div style="float: right; padding: 5px;"><a href="http://www.viewvc.org/"; title="ViewVC Home"><img src="/viewvc-static/images/viewvc-logo.png" alt="ViewVC logotype" width="240" height="70" /></a></div>
+<h1>Log of /branches/tr29124/libstdc++-v3/testsuite/ext/special_functions/airy_ai/compile.cc</h1>
+
+<p style="margin:0;">
+
+<a href="/viewcvs/gcc/branches/tr29124/libstdc%2B%2B-v3/testsuite/ext/special_functions/airy_ai/?sortby=date"><img src="/viewvc-static/images/back_small.png" class="vc_icon" alt="Parent Directory" /> Parent Directory</a>
+
+| <a href="/viewcvs/gcc/branches/tr29124/libstdc%2B%2B-v3/testsuite/ext/special_functions/airy_ai/compile.cc?sortby=date&amp;view=log"><img src="/viewvc-static/images/log.png" class="vc_icon" alt="Revision Log" /> Revision Log</a>
+
+
+
+
+</p>
+
+<hr />
+<table class="auto">
+
+
+
+<tr>
+<td>Links to HEAD:</td>
+<td>
+(<a href="/viewcvs/gcc/branches/tr29124/libstdc%2B%2B-v3/testsuite/ext/special_functions/airy_ai/compile.cc?view=markup&amp;sortby=date">view</a>)
+(<a href="/viewcvs/gcc/branches/tr29124/libstdc%2B%2B-v3/testsuite/ext/special_functions/airy_ai/compile.cc?view=co">download</a>)
+(<a href="/viewcvs/gcc/branches/tr29124/libstdc%2B%2B-v3/testsuite/ext/special_functions/airy_ai/compile.cc?view=co&amp;content-type=text%2Fplain">as text</a>)
+(<a href="/viewcvs/gcc/branches/tr29124/libstdc%2B%2B-v3/testsuite/ext/special_functions/airy_ai/compile.cc?view=annotate&amp;sortby=date">annotate</a>)
+</td>
+</tr>
+
+
+
+<tr>
+<td>Sticky Revision:</td>
+<td><form method="get" action="/viewcvs/gcc" style="display: inline">
+<div style="display: inline">
+<input type="hidden" name="orig_pathtype" value="FILE"/><input type="hidden" name="orig_view" value="log"/><input type="hidden" name="orig_path" value="branches/tr29124/libstdc++-v3/testsuite/ext/special_functions/airy_ai/compile.cc"/><input type="hidden" name="sortby" value="date"/><input type="hidden" name="view" value="redirect_pathrev"/>
+
+<input type="text" name="pathrev" value="" size="6"/>
+
+<input type="submit" value="Set" />
+</div>
+</form>
+
+</td>
+</tr>
+</table>
+ 
+
+
+
+
+
+
+
+
+
+<div>
+<hr />
+
+<a name="rev246919"></a>
+
+
+Revision <a href="/viewcvs/gcc?view=revision&amp;sortby=date&amp;revision=246919"><strong>246919</strong></a> -
+
+
+(<a href="/viewcvs/gcc/branches/tr29124/libstdc%2B%2B-v3/testsuite/ext/special_functions/airy_ai/compile.cc?revision=246919&amp;view=markup&amp;sortby=date">view</a>)
+
+
+(<a href="/viewcvs/gcc/branches/tr29124/libstdc%2B%2B-v3/testsuite/ext/special_functions/airy_ai/compile.cc?revision=246919&amp;view=co">download</a>)
+(<a href="/viewcvs/gcc/branches/tr29124/libstdc%2B%2B-v3/testsuite/ext/special_functions/airy_ai/compile.cc?view=co&amp;revision=246919&amp;content-type=text%2Fplain">as text</a>)
+(<a href="/viewcvs/gcc/branches/tr29124/libstdc%2B%2B-v3/testsuite/ext/special_functions/airy_ai/compile.cc?annotate=246919&amp;sortby=date">annotate</a>)
+
+
+
+- <a href="/viewcvs/gcc/branches/tr29124/libstdc%2B%2B-v3/testsuite/ext/special_functions/airy_ai/compile.cc?sortby=date&amp;view=log&amp;r1=246919&amp;log_pagestart=0">[select for diffs]</a>
+
+
+
+
+<br />
+
+Added
+
+<em>Thu Apr 13 20:26:52 2017 UTC</em>
+(6 months, 3 weeks ago)
+by <em>emsr</em>
+
+
+
+
+
+
+
+<br />File length: 1095 byte(s)
+
+
+
+
+
+
+
+
+
+
+
+<pre class="vc_log">Merged revisions through <a href="/viewcvs/gcc?view=revision&amp;sortby=date&amp;revision=246916">r246916</a> to the branch
+</pre>
+</div>
+
+ 
+
+
+
+
+ <hr />
+<p><a name="diff"></a>
+This form allows you to request diffs between any two revisions of this file.
+For each of the two "sides" of the diff,
+
+enter a numeric revision.
+
+</p>
+<form method="get" action="/viewcvs/gcc/branches/tr29124/libstdc%2B%2B-v3/testsuite/ext/special_functions/airy_ai/compile.cc" id="diff_select">
+<table cellpadding="2" cellspacing="0" class="auto">
+<tr>
+<td>&nbsp;</td>
+<td>
+<input type="hidden" name="sortby" value="date"/><input type="hidden" name="view" value="diff"/>
+Diffs between
+
+<input type="text" size="12" name="r1"
+value="246919" />
+
+and
+
+<input type="text" size="12" name="r2" value="246919" />
+
+</td>
+</tr>
+<tr>
+<td>&nbsp;</td>
+<td>
+Type of Diff should be a
+<select name="diff_format" onchange="submit()">
+<option value="h" selected="selected">Colored Diff</option>
+<option value="l" >Long Colored Diff</option>
+<option value="f" >Full Colored Diff</option>
+<option value="u" >Unidiff</option>
+<option value="c" >Context Diff</option>
+<option value="s" >Side by Side</option>
+</select>
+<input type="submit" value=" Get Diffs " />
+</td>
+</tr>
+</table>
+</form>
+
+
+
+
+
+<hr />
+<table>
+<tr>
+<td>&nbsp;</td>
+<td style="text-align: right;"><strong><a href="/viewvc-static/help_log.html">ViewVC Help</a></strong></td>
+</tr>
+<tr>
+<td>Powered by <a href="http://viewvc.tigris.org/";>ViewVC 1.1.26</a></td>
+<td style="text-align: right;">&nbsp;</td>
+</tr>
+</table>
+</body>
+</html>
+
+
diff --git a/libstdc++-v3/testsuite/ext/special_functions/airy_bi/check_nan.cc b/libstdc++-v3/testsuite/ext/special_functions/airy_bi/check_nan.cc
new file mode 100644
index 0000000..6893fe8
--- /dev/null
+++ b/libstdc++-v3/testsuite/ext/special_functions/airy_bi/check_nan.cc
@@ -0,0 +1,56 @@
+// { dg-require-c-std "" }
+// { dg-add-options ieee }
+// { dg-options "-D__STDCPP_WANT_MATH_SPEC_FUNCS__" }
+
+// Copyright (C) 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
+// 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.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3.  If not see
+// <http://www.gnu.org/licenses/>.
+
+// airy_bi
+
+#include <cmath>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+  float xf = std::numeric_limits<float>::quiet_NaN();
+  double xd = std::numeric_limits<double>::quiet_NaN();
+  long double xl = std::numeric_limits<long double>::quiet_NaN();
+
+  float a = __gnu_cxx::airy_bi(xf);
+  float b = __gnu_cxx::airy_bif(xf);
+  double c = __gnu_cxx::airy_bi(xd);
+  long double d = __gnu_cxx::airy_bi(xl);
+  long double e = __gnu_cxx::airy_bil(xl);
+
+  bool test [[gnu::unused]] = true;
+  VERIFY(std::isnan(a));
+  VERIFY(std::isnan(b));
+  VERIFY(std::isnan(c));
+  VERIFY(std::isnan(d));
+  VERIFY(std::isnan(e));
+
+  return;
+}
+
+int
+main()
+{
+  test01();
+  return 0;
+}
+
diff --git a/libstdc++-v3/testsuite/ext/special_functions/airy_bi/check_value.cc b/libstdc++-v3/testsuite/ext/special_functions/airy_bi/check_value.cc
new file mode 100644
index 0000000..0974003
--- /dev/null
+++ b/libstdc++-v3/testsuite/ext/special_functions/airy_bi/check_value.cc
@@ -0,0 +1,126 @@
+// { dg-do run { target c++11 } }
+// { dg-options "-D__STDCPP_WANT_MATH_SPEC_FUNCS__" }
+//
+// Copyright (C) 2016-2017 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.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3.  If not see
+// <http://www.gnu.org/licenses/>.
+
+//  airy_bi
+
+//  Compare against values generated by the GNU Scientific Library.
+//  The GSL can be found on the web: http://www.gnu.org/software/gsl/
+#include <limits>
+#include <cmath>
+#if defined(__TEST_DEBUG)
+#  include <iostream>
+#  define VERIFY(A) \
+  if (!(A)) \
+    { \
+      std::cout << "line " << __LINE__ \
+	<< "  max_abs_frac = " << max_abs_frac \
+	<< std::endl; \
+    }
+#else
+#  include <testsuite_hooks.h>
+#endif
+#include <specfun_testcase.h>
+
+// Test data.
+// max(|f - f_GSL|): 3.2782554626464844e-06 at index 40
+// max(|f - f_GSL| / |f_GSL|): 1.3623770134694109e-13
+// mean(f - f_GSL): -8.0102555317125191e-08
+// variance(f - f_GSL): 2.6209716422814286e-13
+// stddev(f - f_GSL): 5.1195425989842373e-07
+const testcase_airy_bi<double>
+data001[41] =
+{
+  { -0.31467982964383845, -10.000000000000000, 0.0 },
+  { 0.037785432489467467, -9.5000000000000000, 0.0 },
+  { 0.32494732345524480, -9.0000000000000000, 0.0 },
+  { 0.0077544364476580746, -8.5000000000000000, 0.0 },
+  { -0.33125158075113792, -8.0000000000000000, 0.0 },
+  { -0.11246348507649087, -7.5000000000000000, 0.0 },
+  { 0.29376207185441372, -7.0000000000000000, 0.0 },
+  { 0.26101265763648318, -6.5000000000000000, 0.0 },
+  { -0.14669837667055663, -6.0000000000000000, 0.0 },
+  { -0.36781345391571185, -5.5000000000000000, 0.0 },
+  { -0.13836913490160088, -5.0000000000000000, 0.0 },
+  { 0.25387265769693296, -4.5000000000000000, 0.0 },
+  { 0.39223470570699931, -4.0000000000000000, 0.0 },
+  { 0.16893983748105870, -3.5000000000000000, 0.0 },
+  { -0.19828962637492650, -3.0000000000000000, 0.0 },
+  { -0.43242247184070520, -2.5000000000000000, 0.0 },
+  { -0.41230258795639835, -2.0000000000000000, 0.0 },
+  { -0.19178486115704119, -1.5000000000000000, 0.0 },
+  { 0.10399738949694459, -1.0000000000000000, 0.0 },
+  { 0.38035265975105381, -0.50000000000000000, 0.0 },
+  { 0.61492662744600068, 0.0000000000000000, 0.0 },
+  { 0.85427704310315555, 0.50000000000000000, 0.0 },
+  { 1.2074235949528713, 1.0000000000000000, 0.0 },
+  { 1.8789415037478949, 1.5000000000000000, 0.0 },
+  { 3.2980949999782148, 2.0000000000000000, 0.0 },
+  { 6.4816607384605804, 2.5000000000000000, 0.0 },
+  { 14.037328963730236, 3.0000000000000000, 0.0 },
+  { 33.055506754611478, 3.5000000000000000, 0.0 },
+  { 83.847071408468111, 4.0000000000000000, 0.0 },
+  { 227.58808183559950, 4.5000000000000000, 0.0 },
+  { 657.79204417117160, 5.0000000000000000, 0.0 },
+  { 2016.5800386595315, 5.5000000000000000, 0.0 },
+  { 6536.4461048098583, 6.0000000000000000, 0.0 },
+  { 22340.607718396990, 6.5000000000000000, 0.0 },
+  { 80327.790709430337, 7.0000000000000000, 0.0 },
+  { 303229.61511253362, 7.5000000000000000, 0.0 },
+  { 1199586.0041244617, 8.0000000000000000, 0.0 },
+  { 4965319.5414712988, 8.5000000000000000, 0.0 },
+  { 21472868.891435351, 9.0000000000000000, 0.0 },
+  { 96892265.580451161, 9.5000000000000000, 0.0 },
+  { 455641153.54822654, 10.000000000000000, 0.0 },
+};
+const double toler001 = 1.0000000000000006e-11;
+
+template<typename Ret, unsigned int Num>
+  void
+  test(const testcase_airy_bi<Ret> (&data)[Num], Ret toler)
+  {
+    bool test __attribute__((unused)) = true;
+    const Ret eps = std::numeric_limits<Ret>::epsilon();
+    Ret max_abs_diff = -Ret(1);
+    Ret max_abs_frac = -Ret(1);
+    unsigned int num_datum = Num;
+    for (unsigned int i = 0; i < num_datum; ++i)
+      {
+	const Ret f = __gnu_cxx::airy_bi(data[i].x);
+	const Ret f0 = data[i].f0;
+	const Ret diff = f - f0;
+	if (std::abs(diff) > max_abs_diff)
+	  max_abs_diff = std::abs(diff);
+	if (std::abs(f0) > Ret(10) * eps
+	 && std::abs(f) > Ret(10) * eps)
+	  {
+	    const Ret frac = diff / f0;
+	    if (std::abs(frac) > max_abs_frac)
+	      max_abs_frac = std::abs(frac);
+	  }
+      }
+    VERIFY(max_abs_frac < toler);
+  }
+
+int
+main()
+{
+  test(data001, toler001);
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/ext/special_functions/airy_bi/compile.cc b/libstdc++-v3/testsuite/ext/special_functions/airy_bi/compile.cc
new file mode 100644
index 0000000..99b6044
--- /dev/null
+++ b/libstdc++-v3/testsuite/ext/special_functions/airy_bi/compile.cc
@@ -0,0 +1,40 @@
+// { dg-do compile }
+// { dg-options "-D__STDCPP_WANT_MATH_SPEC_FUNCS__" }
+
+// Copyright (C) 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
+// 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.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3.  If not see
+// <http://www.gnu.org/licenses/>.
+
+// airy_bi
+
+#include <cmath>
+
+void
+test01()
+{
+  float xf = 0.5F;
+  double xd = 0.5;
+  long double xl = 0.5L;
+
+  __gnu_cxx::airy_bi(xf);
+  __gnu_cxx::airy_bif(xf);
+  __gnu_cxx::airy_bi(xd);
+  __gnu_cxx::airy_bi(xl);
+  __gnu_cxx::airy_bil(xl);
+
+  return;
+}
+

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]