aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3
diff options
context:
space:
mode:
authorEdward Smith-Rowland <3dw4rd@verizon.net>2017-11-18 19:53:25 +0000
committerEdward Smith-Rowland <emsr@gcc.gnu.org>2017-11-18 19:53:25 +0000
commita7a389d6eee846a877b79c733d853cd2e6b162da (patch)
tree05cdcca745f49e08c16a41bc873809db9a92200d /libstdc++-v3
parenta7037861a77985c3a8bccab9eefc02179694aa8e (diff)
downloadgcc-a7a389d6eee846a877b79c733d853cd2e6b162da.zip
gcc-a7a389d6eee846a877b79c733d853cd2e6b162da.tar.gz
gcc-a7a389d6eee846a877b79c733d853cd2e6b162da.tar.bz2
specfun.h: Expose airy_ai and airy_bi.
2017-11-18 Edward Smith-Rowland <3dw4rd@verizon.net> * include/bits/specfun.h: Expose airy_ai and airy_bi. * include/tr1/modified_bessel_func.tcc: Treat NaN and inf arg, return. * testsuite/ext/special_functions/airy_ai/check_nan.cc: New. * testsuite/ext/special_functions/airy_ai/check_value.cc: New. * testsuite/ext/special_functions/airy_ai/compile.cc: New. * testsuite/ext/special_functions/airy_bi/check_nan.cc: New. * testsuite/ext/special_functions/airy_bi/check_value.cc: New. * testsuite/ext/special_functions/airy_bi/compile.cc: New. From-SVN: r254917
Diffstat (limited to 'libstdc++-v3')
-rw-r--r--libstdc++-v3/ChangeLog11
-rw-r--r--libstdc++-v3/include/bits/specfun.h72
-rw-r--r--libstdc++-v3/include/tr1/modified_bessel_func.tcc13
-rw-r--r--libstdc++-v3/testsuite/ext/special_functions/airy_ai/check_nan.cc57
-rw-r--r--libstdc++-v3/testsuite/ext/special_functions/airy_ai/check_value.cc126
-rw-r--r--libstdc++-v3/testsuite/ext/special_functions/airy_ai/compile.cc40
-rw-r--r--libstdc++-v3/testsuite/ext/special_functions/airy_bi/check_nan.cc57
-rw-r--r--libstdc++-v3/testsuite/ext/special_functions/airy_bi/check_value.cc126
-rw-r--r--libstdc++-v3/testsuite/ext/special_functions/airy_bi/compile.cc40
9 files changed, 541 insertions, 1 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 122c5c6..4c348f1 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,14 @@
+2017-11-18 Edward Smith-Rowland <3dw4rd@verizon.net>
+ Expose Airy functions as an extenaion.
+ * include/bits/specfun.h: Expose airy_ai and airy_bi.
+ * include/tr1/modified_bessel_func.tcc: Treat NaN and inf arg, return.
+ * testsuite/ext/special_functions/airy_ai/check_nan.cc: New.
+ * testsuite/ext/special_functions/airy_ai/check_value.cc: New.
+ * testsuite/ext/special_functions/airy_ai/compile.cc: New.
+ * testsuite/ext/special_functions/airy_bi/check_nan.cc: New.
+ * testsuite/ext/special_functions/airy_bi/check_value.cc: New.
+ * testsuite/ext/special_functions/airy_bi/compile.cc: New.
+
2017-11-17 Igor Tsimbalist <igor.v.tsimbalist@intel.com>
* acinclude.m4: Add cet.m4.
diff --git a/libstdc++-v3/include/bits/specfun.h b/libstdc++-v3/include/bits/specfun.h
index 6bb3ec0..93ba8fa 100644
--- a/libstdc++-v3/include/bits/specfun.h
+++ b/libstdc++-v3/include/bits/specfun.h
@@ -1206,6 +1206,78 @@ 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 <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(_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 __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 <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..3910b95 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..883af54
--- /dev/null
+++ b/libstdc++-v3/testsuite/ext/special_functions/airy_ai/check_nan.cc
@@ -0,0 +1,57 @@
+// { dg-do run { target c++11 } }
+// { dg-require-c-std "" }
+// { dg-add-options ieee }
+// { 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
+
+#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_ai(xf);
+ float b = __gnu_cxx::airy_aif(xf);
+ double c = __gnu_cxx::airy_ai(xd);
+ long double d = __gnu_cxx::airy_ai(xl);
+ long double e = __gnu_cxx::airy_ail(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_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..ecd17df
--- /dev/null
+++ b/libstdc++-v3/testsuite/ext/special_functions/airy_ai/compile.cc
@@ -0,0 +1,40 @@
+// { dg-do compile { 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
+
+#include <cmath>
+
+void
+test01()
+{
+ float xf = 0.5F;
+ double xd = 0.5;
+ long double xl = 0.5L;
+
+ __gnu_cxx::airy_ai(xf);
+ __gnu_cxx::airy_aif(xf);
+ __gnu_cxx::airy_ai(xd);
+ __gnu_cxx::airy_ai(xl);
+ __gnu_cxx::airy_ail(xl);
+
+ return;
+}
+
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..b0bed0b
--- /dev/null
+++ b/libstdc++-v3/testsuite/ext/special_functions/airy_bi/check_nan.cc
@@ -0,0 +1,57 @@
+// { dg-do run { target c++11 } }
+// { dg-require-c-std "" }
+// { dg-add-options ieee }
+// { 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
+
+#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..0dd36e0
--- /dev/null
+++ b/libstdc++-v3/testsuite/ext/special_functions/airy_bi/compile.cc
@@ -0,0 +1,40 @@
+// { dg-do compile { 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
+
+#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;
+}
+