summaryrefslogtreecommitdiff
path: root/libstdc++-v3/testsuite/26_numerics/headers/cmath
diff options
context:
space:
mode:
authorupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
committerupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
commit554fd8c5195424bdbcabf5de30fdc183aba391bd (patch)
tree976dc5ab7fddf506dadce60ae936f43f58787092 /libstdc++-v3/testsuite/26_numerics/headers/cmath
downloadcbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.bz2
cbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.xz
obtained gcc-4.6.4.tar.bz2 from upstream website;upstream
verified gcc-4.6.4.tar.bz2.sig; imported gcc-4.6.4 source tree from verified upstream tarball. downloading a git-generated archive based on the 'upstream' tag should provide you with a source tree that is binary identical to the one extracted from the above tarball. if you have obtained the source via the command 'git clone', however, do note that line-endings of files in your working directory might differ from line-endings of the respective files in the upstream repository.
Diffstat (limited to 'libstdc++-v3/testsuite/26_numerics/headers/cmath')
-rw-r--r--libstdc++-v3/testsuite/26_numerics/headers/cmath/19322.cc35
-rw-r--r--libstdc++-v3/testsuite/26_numerics/headers/cmath/25913.cc38
-rw-r--r--libstdc++-v3/testsuite/26_numerics/headers/cmath/37582.cc35
-rw-r--r--libstdc++-v3/testsuite/26_numerics/headers/cmath/c99_classification_macros_c++.cc84
-rw-r--r--libstdc++-v3/testsuite/26_numerics/headers/cmath/c99_classification_macros_c++0x.cc92
-rw-r--r--libstdc++-v3/testsuite/26_numerics/headers/cmath/c99_classification_macros_c.cc51
-rw-r--r--libstdc++-v3/testsuite/26_numerics/headers/cmath/c_math.cc70
-rw-r--r--libstdc++-v3/testsuite/26_numerics/headers/cmath/c_math_dynamic.cc49
-rw-r--r--libstdc++-v3/testsuite/26_numerics/headers/cmath/dr550.cc46
-rw-r--r--libstdc++-v3/testsuite/26_numerics/headers/cmath/fabs_inline.cc36
-rw-r--r--libstdc++-v3/testsuite/26_numerics/headers/cmath/functions_std.cc46
-rw-r--r--libstdc++-v3/testsuite/26_numerics/headers/cmath/macros.cc27
-rw-r--r--libstdc++-v3/testsuite/26_numerics/headers/cmath/overloads.cc47
-rw-r--r--libstdc++-v3/testsuite/26_numerics/headers/cmath/powi.cc63
-rw-r--r--libstdc++-v3/testsuite/26_numerics/headers/cmath/types_std_c++0x.cc31
-rw-r--r--libstdc++-v3/testsuite/26_numerics/headers/cmath/types_std_c++0x_neg.cc73
16 files changed, 823 insertions, 0 deletions
diff --git a/libstdc++-v3/testsuite/26_numerics/headers/cmath/19322.cc b/libstdc++-v3/testsuite/26_numerics/headers/cmath/19322.cc
new file mode 100644
index 000000000..25494c357
--- /dev/null
+++ b/libstdc++-v3/testsuite/26_numerics/headers/cmath/19322.cc
@@ -0,0 +1,35 @@
+// { dg-require-c-std "" }
+
+// Copyright (C) 2005, 2009, 2010, 2011 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/>.
+
+#include <cmath>
+#include <testsuite_hooks.h>
+
+// libstdc++/19322
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ VERIFY( !std::isnan(3.0) );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/26_numerics/headers/cmath/25913.cc b/libstdc++-v3/testsuite/26_numerics/headers/cmath/25913.cc
new file mode 100644
index 000000000..025db2c2c
--- /dev/null
+++ b/libstdc++-v3/testsuite/26_numerics/headers/cmath/25913.cc
@@ -0,0 +1,38 @@
+// Copyright (C) 2007, 2009 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/>.
+
+
+// { dg-do compile }
+
+#include <cmath>
+#include <string>
+
+struct employee
+: private std::string { };
+
+struct manager
+: public employee { };
+
+bool isnormal(const employee&)
+{ return false; }
+
+// libstdc++/25913
+void test01()
+{
+ manager m;
+ isnormal(m);
+}
diff --git a/libstdc++-v3/testsuite/26_numerics/headers/cmath/37582.cc b/libstdc++-v3/testsuite/26_numerics/headers/cmath/37582.cc
new file mode 100644
index 000000000..0cec658d8
--- /dev/null
+++ b/libstdc++-v3/testsuite/26_numerics/headers/cmath/37582.cc
@@ -0,0 +1,35 @@
+// Copyright (C) 2008, 2009 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/>.
+
+
+// { dg-do compile }
+
+#include <cmath>
+
+struct foo
+{
+ foo (double);
+};
+
+bool operator &&(int, const foo &);
+
+// libstdc++/37582
+double
+test01(double x)
+{
+ return std::pow (x, 2.0);
+}
diff --git a/libstdc++-v3/testsuite/26_numerics/headers/cmath/c99_classification_macros_c++.cc b/libstdc++-v3/testsuite/26_numerics/headers/cmath/c99_classification_macros_c++.cc
new file mode 100644
index 000000000..3f4b8ba26
--- /dev/null
+++ b/libstdc++-v3/testsuite/26_numerics/headers/cmath/c99_classification_macros_c++.cc
@@ -0,0 +1,84 @@
+// 2001-04-06 gdr
+
+// Copyright (C) 2001, 2005, 2009 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/>.
+
+
+// { dg-do compile { xfail uclibc } }
+// { dg-excess-errors "" { target uclibc } }
+
+#include <cmath>
+
+void fpclassify() { }
+
+void isfinite() { }
+
+void isinf() { }
+
+void isnan() { }
+
+void isnormal() { }
+
+void signbit() { }
+
+void isgreater() { }
+
+void isgreaterequal() { }
+
+void isless() { }
+
+void islessequal() { }
+
+void islessgreater() { }
+
+void isunordered() { }
+
+#if _GLIBCXX_USE_C99_MATH
+template <typename _Tp>
+ void test_c99_classify()
+ {
+ bool test __attribute__((unused)) = true;
+
+ typedef _Tp fp_type;
+ fp_type f1 = 1.0;
+ fp_type f2 = 3.0;
+ int res = 0;
+
+ res = std::fpclassify(f1);
+ res = std::isfinite(f2);
+ res = std::isinf(f1);
+ res = std::isnan(f2);
+ res = std::isnormal(f1);
+ res = std::signbit(f2);
+ res = std::isgreater(f1, f2);
+ res = std::isgreaterequal(f1, f2);
+ res = std::isless(f1, f2);
+ res = std::islessequal(f1,f2);
+ res = std::islessgreater(f1, f2);
+ res = std::isunordered(f1, f2);
+ res = res; // Suppress unused warning.
+ }
+#endif
+
+int main()
+{
+#if _GLIBCXX_USE_C99_MATH
+ test_c99_classify<float>();
+ test_c99_classify<double>();
+#endif
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/26_numerics/headers/cmath/c99_classification_macros_c++0x.cc b/libstdc++-v3/testsuite/26_numerics/headers/cmath/c99_classification_macros_c++0x.cc
new file mode 100644
index 000000000..413fe6925
--- /dev/null
+++ b/libstdc++-v3/testsuite/26_numerics/headers/cmath/c99_classification_macros_c++0x.cc
@@ -0,0 +1,92 @@
+// Copyright (C) 2010 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/>.
+
+// { dg-options "-std=gnu++0x" }
+// { dg-do compile { xfail uclibc } }
+// { dg-excess-errors "" { target uclibc } }
+
+#include <cmath>
+
+void fpclassify() { }
+
+void isfinite() { }
+
+void isinf() { }
+
+void isnan() { }
+
+void isnormal() { }
+
+void signbit() { }
+
+void isgreater() { }
+
+void isgreaterequal() { }
+
+void isless() { }
+
+void islessequal() { }
+
+void islessgreater() { }
+
+void isunordered() { }
+
+#if _GLIBCXX_USE_C99_MATH
+template <typename _Tp, typename _Up = _Tp>
+ void test_c99_classify()
+ {
+ bool test __attribute__((unused)) = true;
+
+ typedef _Tp fp_type_one;
+ typedef _Up fp_type_two;
+ fp_type_one f1 = 1.0;
+ fp_type_two f2 = 3.0;
+ int resi;
+ bool res;
+
+ resi = std::fpclassify(f1);
+ res = std::isfinite(f2);
+ res = std::isinf(f1);
+ res = std::isnan(f2);
+ res = std::isnormal(f1);
+ res = std::signbit(f2);
+ res = std::isgreater(f1, f2);
+ res = std::isgreaterequal(f1, f2);
+ res = std::isless(f1, f2);
+ res = std::islessequal(f1,f2);
+ res = std::islessgreater(f1, f2);
+ res = std::isunordered(f1, f2);
+ resi = resi; // Suppress unused warning.
+ res = res;
+ }
+#endif
+
+int main()
+{
+#if _GLIBCXX_USE_C99_MATH
+ test_c99_classify<float>();
+ test_c99_classify<double>();
+ test_c99_classify<long double>();
+ test_c99_classify<float, double>();
+ test_c99_classify<float, long double>();
+ test_c99_classify<double, float>();
+ test_c99_classify<double, long double>();
+ test_c99_classify<long double, float>();
+ test_c99_classify<long double, double>();
+#endif
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/26_numerics/headers/cmath/c99_classification_macros_c.cc b/libstdc++-v3/testsuite/26_numerics/headers/cmath/c99_classification_macros_c.cc
new file mode 100644
index 000000000..716dda51b
--- /dev/null
+++ b/libstdc++-v3/testsuite/26_numerics/headers/cmath/c99_classification_macros_c.cc
@@ -0,0 +1,51 @@
+// 2001-04-06 gdr
+
+// Copyright (C) 2001, 2005, 2009, 2010 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/>.
+
+// { dg-do compile }
+// { dg-add-options no_pch }
+
+// { dg-xfail-if "" { { *-*-linux* *-*-darwin* *-*-solaris2.1[0-9]* hppa*-*-hpux* } || { uclibc || newlib } } { "*" } { "" } }
+// { dg-excess-errors "" { target { { *-*-linux* *-*-darwin* *-*-solaris2.1[0-9]* hppa*-*-hpux* } || { uclibc || newlib } } } }
+
+#include <math.h>
+
+void fpclassify() { }
+
+void isfinite() { }
+
+void isinf() { }
+
+void isnan() { }
+
+void isnormal() { }
+
+void signbit() { }
+
+void isgreater() { }
+
+void isgreaterequal() { }
+
+void isless() { }
+
+void islessequal() { }
+
+void islessgreater() { }
+
+void isunordered() { }
+
diff --git a/libstdc++-v3/testsuite/26_numerics/headers/cmath/c_math.cc b/libstdc++-v3/testsuite/26_numerics/headers/cmath/c_math.cc
new file mode 100644
index 000000000..b8cf6e5e1
--- /dev/null
+++ b/libstdc++-v3/testsuite/26_numerics/headers/cmath/c_math.cc
@@ -0,0 +1,70 @@
+// 1999-06-05
+// Gabriel Dos Reis <dosreis@cmla.ens-cachan.fr>
+
+// Copyright (C) 1999, 2000, 2009 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/>.
+
+#include <cmath>
+#include <testsuite_hooks.h>
+
+// test compilation.
+int
+test01()
+{
+ float a = 1.f;
+ float b;
+ std::modf(a, &b);
+ return 0;
+}
+
+// need more extravagant checks than this, of course, but this used to core...
+int
+test02()
+{
+ std::sin(static_cast<float>(0));
+ return 0;
+}
+
+// as did this.
+int
+test03()
+{
+ double powtest __attribute__((unused)) = std::pow(2., 0);
+ return 0;
+}
+
+// this used to abort.
+int
+test04()
+{
+ bool test __attribute__((unused)) = true;
+ float x[2] = {1, 2};
+ float y = 3.4;
+ std::modf(y, &x[0]);
+ VERIFY(x[1] == 2);
+ return 0;
+}
+
+int
+main()
+{
+ test01();
+ test02();
+ test03();
+ test04();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/26_numerics/headers/cmath/c_math_dynamic.cc b/libstdc++-v3/testsuite/26_numerics/headers/cmath/c_math_dynamic.cc
new file mode 100644
index 000000000..de4dbe39c
--- /dev/null
+++ b/libstdc++-v3/testsuite/26_numerics/headers/cmath/c_math_dynamic.cc
@@ -0,0 +1,49 @@
+// Inspired by libstdc++/7680 & 26_numerics/c_math.cc, 2003-04-12 ljr
+
+// Copyright (C) 2003, 2009 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/>.
+
+
+// { dg-do link }
+// { dg-options "-D_XOPEN_SOURCE" { target *-*-freebsd* } }
+
+#include <cmath>
+
+int
+test01()
+{
+ float a = 1.f;
+ float b;
+ std::modf(a, &b);
+ return 0;
+}
+
+int
+test02 ()
+{
+ float a = 0.0f;
+ float b __attribute__((unused)) = std::acos(a);
+ return 0;
+}
+
+int
+main()
+{
+ test01();
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/26_numerics/headers/cmath/dr550.cc b/libstdc++-v3/testsuite/26_numerics/headers/cmath/dr550.cc
new file mode 100644
index 000000000..c8f7c5cc5
--- /dev/null
+++ b/libstdc++-v3/testsuite/26_numerics/headers/cmath/dr550.cc
@@ -0,0 +1,46 @@
+// { dg-options "-std=gnu++0x" }
+// 2008-05-26 Paolo Carlini <paolo.carlini@oracle.com>
+//
+// Copyright (C) 2008, 2009 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/>.
+
+#include <cmath>
+#include <testsuite_hooks.h>
+#include <testsuite_tr1.h>
+
+// DR 550. What should the return type of pow(float,int) be?
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ using __gnu_test::check_ret_type;
+
+ const int i1 = 1;
+ const float f1 = 1.0f;
+ const double d1 = 1.0;
+ const long double ld1 = 1.0l;
+
+ check_ret_type<double>(std::pow(f1, i1));
+ VERIFY( std::pow(f1, i1) == std::pow(double(f1), double(i1)) );
+ check_ret_type<double>(std::pow(d1, i1));
+ check_ret_type<long double>(std::pow(ld1, i1));
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/26_numerics/headers/cmath/fabs_inline.cc b/libstdc++-v3/testsuite/26_numerics/headers/cmath/fabs_inline.cc
new file mode 100644
index 000000000..17057773e
--- /dev/null
+++ b/libstdc++-v3/testsuite/26_numerics/headers/cmath/fabs_inline.cc
@@ -0,0 +1,36 @@
+// Copyright (C) 1999, 2002, 2009 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/>.
+
+// Test to see whether the host provides its own (inline) view of fabs.
+// Origin: Kurt Garloff <kurt@garloff.de>, 2001-05-24
+// dg-do link
+
+#include <cmath>
+#include <cstdio>
+
+typedef double (*realfn) (double);
+
+using std::fabs;
+
+int main ()
+{
+ double a = fabs (-2.4);
+ realfn myfn = fabs;
+ double b = myfn (-2.5);
+ std::printf ("%f, %f, %p\n", a, b, myfn);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/26_numerics/headers/cmath/functions_std.cc b/libstdc++-v3/testsuite/26_numerics/headers/cmath/functions_std.cc
new file mode 100644
index 000000000..5226ee4eb
--- /dev/null
+++ b/libstdc++-v3/testsuite/26_numerics/headers/cmath/functions_std.cc
@@ -0,0 +1,46 @@
+// { dg-do compile }
+
+// Copyright (C) 2007, 2009 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/>.
+
+#include <cmath>
+
+namespace gnu
+{
+ using std::acos;
+ using std::asin;
+ using std::atan;
+ using std::atan2;
+ using std::ceil;
+ using std::cos;
+ using std::cosh;
+ using std::exp;
+ using std::fabs;
+ using std::floor;
+ using std::fmod;
+ using std::frexp;
+ using std::ldexp;
+ using std::log;
+ using std::log10;
+ using std::modf;
+ using std::pow;
+ using std::sin;
+ using std::sinh;
+ using std::sqrt;
+ using std::tan;
+ using std::tanh;
+}
diff --git a/libstdc++-v3/testsuite/26_numerics/headers/cmath/macros.cc b/libstdc++-v3/testsuite/26_numerics/headers/cmath/macros.cc
new file mode 100644
index 000000000..754f94402
--- /dev/null
+++ b/libstdc++-v3/testsuite/26_numerics/headers/cmath/macros.cc
@@ -0,0 +1,27 @@
+// { dg-do compile }
+
+// Copyright (C) 2007, 2009 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/>.
+
+#include <cmath>
+
+namespace gnu
+{
+#ifndef HUGE_VAL
+ #error "HUGE_VAL_must_be_a_macro"
+#endif
+}
diff --git a/libstdc++-v3/testsuite/26_numerics/headers/cmath/overloads.cc b/libstdc++-v3/testsuite/26_numerics/headers/cmath/overloads.cc
new file mode 100644
index 000000000..5819e1a18
--- /dev/null
+++ b/libstdc++-v3/testsuite/26_numerics/headers/cmath/overloads.cc
@@ -0,0 +1,47 @@
+// Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+// 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/>.
+
+// PR 3181
+// Origin: pete@toyon.com
+
+#include <cmath>
+
+int main()
+{
+ int i = -1;
+ int j = 9;
+ double ans;
+ ans = std::abs(i);
+ ans = std::acos(i);
+ ans = std::asin(i);
+ ans = std::atan(i);
+ ans = std::atan2(i, j);
+ ans = std::cos(i);
+ ans = std::cosh(i);
+ ans = std::exp(i);
+ ans = std::fabs(i);
+ ans = std::floor(i);
+ ans = std::log(i);
+ ans = std::log10(i);
+ ans = std::sqrt(i);
+ ans = std::sin(i);
+ ans = std::sinh(j);
+ ans = std::tan(i);
+ ans = std::tanh(i);
+ ans = ans; // Suppress unused warnings.
+}
diff --git a/libstdc++-v3/testsuite/26_numerics/headers/cmath/powi.cc b/libstdc++-v3/testsuite/26_numerics/headers/cmath/powi.cc
new file mode 100644
index 000000000..2af912357
--- /dev/null
+++ b/libstdc++-v3/testsuite/26_numerics/headers/cmath/powi.cc
@@ -0,0 +1,63 @@
+// 2005-02-13 Paolo Carlini <pcarlini@suse.de>
+
+// Copyright (C) 2005, 2009 Free Software Foundation
+//
+// 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/>.
+
+// 26.5 C Library
+
+#include <cmath>
+#include <testsuite_hooks.h>
+
+template<typename T>
+ void test01_do()
+ {
+ using namespace std;
+ bool test __attribute__((unused)) = true;
+
+ VERIFY( pow(T(1.0), 0) == T(1.0) );
+ VERIFY( pow(T(2.0), 0) == T(1.0) );
+ VERIFY( pow(T(-1.0), 0) == T(1.0) );
+ VERIFY( pow(T(-4.0), 0) == T(1.0) );
+
+ VERIFY( pow(T(1.0), 1) == T(1.0) );
+ VERIFY( pow(T(2.0), 1) == T(2.0) );
+ VERIFY( pow(T(-1.0), 1) == T(-1.0) );
+ VERIFY( pow(T(-4.0), 1) == T(-4.0) );
+
+ VERIFY( pow(T(1.0), -1) == T(1.0) / T(1.0) );
+ VERIFY( pow(T(2.0), -1) == T(1.0) / T(2.0) );
+ VERIFY( pow(T(-1.0), -1) == T(1.0) / T(-1.0) );
+ VERIFY( pow(T(-4.0), -1) == T(1.0) / T(-4.0) );
+
+ VERIFY( pow(T(1.0), 2) == T(1.0) * T(1.0) );
+ VERIFY( pow(T(2.0), 2) == T(2.0) * T(2.0) );
+ VERIFY( pow(T(-1.0), 2) == T(-1.0) * T(-1.0) );
+ VERIFY( pow(T(-4.0), 2) == T(-4.0) * T(-4.0) );
+ }
+
+void test01()
+{
+ test01_do<float>();
+ test01_do<double>();
+ test01_do<long double>();
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/26_numerics/headers/cmath/types_std_c++0x.cc b/libstdc++-v3/testsuite/26_numerics/headers/cmath/types_std_c++0x.cc
new file mode 100644
index 000000000..7e4abe90e
--- /dev/null
+++ b/libstdc++-v3/testsuite/26_numerics/headers/cmath/types_std_c++0x.cc
@@ -0,0 +1,31 @@
+// { dg-options "-std=gnu++0x" }
+// { dg-do compile }
+
+// Copyright (C) 2007, 2009 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/>.
+
+#include <cmath>
+
+void test01()
+{
+#if _GLIBCXX_USE_C99_MATH_TR1
+
+ typedef std::double_t my_double_t;
+ typedef std::float_t my_float_t;
+
+#endif
+}
diff --git a/libstdc++-v3/testsuite/26_numerics/headers/cmath/types_std_c++0x_neg.cc b/libstdc++-v3/testsuite/26_numerics/headers/cmath/types_std_c++0x_neg.cc
new file mode 100644
index 000000000..27fd15cde
--- /dev/null
+++ b/libstdc++-v3/testsuite/26_numerics/headers/cmath/types_std_c++0x_neg.cc
@@ -0,0 +1,73 @@
+// { dg-options "-std=gnu++0x" }
+// { dg-do compile }
+
+// Copyright (C) 2007, 2009 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/>.
+
+#include <cmath>
+
+namespace gnu
+{
+ // C++0x changes from TR1.
+ using std::assoc_laguerre;
+ using std::assoc_legendre;
+ using std::beta;
+ using std::comp_ellint_1;
+ using std::comp_ellint_2;
+ using std::comp_ellint_3;
+ using std::conf_hyperg;
+ using std::cyl_bessel_i;
+ using std::cyl_bessel_j;
+ using std::cyl_bessel_k;
+ using std::cyl_neumann;
+ using std::ellint_1;
+ using std::ellint_2;
+ using std::ellint_3;
+ using std::expint;
+ using std::hermite;
+ using std::hyperg;
+ using std::laguerre;
+ using std::legendre;
+ using std::riemann_zeta;
+ using std::sph_bessel;
+ using std::sph_legendre;
+ using std::sph_neumann;
+}
+
+// { dg-error "has not been declared" "" { target *-*-* } 26 }
+// { dg-error "has not been declared" "" { target *-*-* } 27 }
+// { dg-error "has not been declared" "" { target *-*-* } 28 }
+// { dg-error "has not been declared" "" { target *-*-* } 29 }
+// { dg-error "has not been declared" "" { target *-*-* } 30 }
+// { dg-error "has not been declared" "" { target *-*-* } 31 }
+// { dg-error "has not been declared" "" { target *-*-* } 32 }
+// { dg-error "has not been declared" "" { target *-*-* } 33 }
+// { dg-error "has not been declared" "" { target *-*-* } 34 }
+// { dg-error "has not been declared" "" { target *-*-* } 35 }
+// { dg-error "has not been declared" "" { target *-*-* } 36 }
+// { dg-error "has not been declared" "" { target *-*-* } 37 }
+// { dg-error "has not been declared" "" { target *-*-* } 38 }
+// { dg-error "has not been declared" "" { target *-*-* } 39 }
+// { dg-error "has not been declared" "" { target *-*-* } 40 }
+// { dg-error "has not been declared" "" { target *-*-* } 41 }
+// { dg-error "has not been declared" "" { target *-*-* } 42 }
+// { dg-error "has not been declared" "" { target *-*-* } 43 }
+// { dg-error "has not been declared" "" { target *-*-* } 44 }
+// { dg-error "has not been declared" "" { target *-*-* } 45 }
+// { dg-error "has not been declared" "" { target *-*-* } 46 }
+// { dg-error "has not been declared" "" { target *-*-* } 47 }
+// { dg-error "has not been declared" "" { target *-*-* } 48 }