diff options
author | Paolo Carlini <pcarlini@suse.de> | 2006-03-10 13:24:57 +0000 |
---|---|---|
committer | Paolo Carlini <paolo@gcc.gnu.org> | 2006-03-10 13:24:57 +0000 |
commit | 9a7ab578fb581fd0885c7841706876315b1bbc4b (patch) | |
tree | 6115e2c2f2b494731a1f82cf33bdde9825984c6e | |
parent | 7a6164d4fe7e5b85de6fe9f469b34e630c9589da (diff) | |
download | gcc-9a7ab578fb581fd0885c7841706876315b1bbc4b.zip gcc-9a7ab578fb581fd0885c7841706876315b1bbc4b.tar.gz gcc-9a7ab578fb581fd0885c7841706876315b1bbc4b.tar.bz2 |
cmath: Add atan2 and pow bits; add using declarations.
2006-03-10 Paolo Carlini <pcarlini@suse.de>
* include/tr1/cmath: Add atan2 and pow bits; add using declarations.
* include/tr1/math.h: Add using declarations.
* include/tr1/complex: Add using declarations.
* testsuite/tr1/8_c_compatibility/cmath/functions.cc: Fully
qualify calls.
* testsuite/tr1/8_c_compatibility/cmath/overloads.cc: Likewise;
add atan2 and pow bits.
* testsuite/tr1/8_c_compatibility/complex/overloads_float.cc: Likewise.
* testsuite/tr1/8_c_compatibility/complex/overloads_int.cc: Likewise;
adjust polar bits.
* acinclude.m4 ([GLIBCXX_CHECK_C99_TR1]): Add checks for double_t
and float_t typedefs.
* include/tr1/cmath: Add double_t and float_t.
* testsuite/tr1/8_c_compatibility/cmath/types.cc: New.
* include/tr1/ctgmath: New.
* include/tr1/tgmath.h: Likewise.
* include/Makefile.am: Add.
* testsuite/tr1/headers.cc: Update.
* include/Makefile.in: Regenerate.
* configure: Likewise.
* docs/html/ext/tr1.html: Update.
From-SVN: r111931
-rw-r--r-- | libstdc++-v3/ChangeLog | 28 | ||||
-rw-r--r-- | libstdc++-v3/acinclude.m4 | 4 | ||||
-rwxr-xr-x | libstdc++-v3/configure | 4 | ||||
-rw-r--r-- | libstdc++-v3/docs/html/ext/tr1.html | 24 | ||||
-rw-r--r-- | libstdc++-v3/include/Makefile.am | 2 | ||||
-rw-r--r-- | libstdc++-v3/include/Makefile.in | 2 | ||||
-rw-r--r-- | libstdc++-v3/include/tr1/cmath | 82 | ||||
-rw-r--r-- | libstdc++-v3/include/tr1/complex | 14 | ||||
-rw-r--r-- | libstdc++-v3/include/tr1/ctgmath | 39 | ||||
-rw-r--r-- | libstdc++-v3/include/tr1/math.h | 60 | ||||
-rw-r--r-- | libstdc++-v3/include/tr1/tgmath.h | 39 | ||||
-rw-r--r-- | libstdc++-v3/testsuite/tr1/8_c_compatibility/cmath/functions.cc | 210 | ||||
-rw-r--r-- | libstdc++-v3/testsuite/tr1/8_c_compatibility/cmath/overloads.cc | 413 | ||||
-rw-r--r-- | libstdc++-v3/testsuite/tr1/8_c_compatibility/cmath/types.cc | 35 | ||||
-rw-r--r-- | libstdc++-v3/testsuite/tr1/8_c_compatibility/complex/overloads_float.cc | 106 | ||||
-rw-r--r-- | libstdc++-v3/testsuite/tr1/8_c_compatibility/complex/overloads_int.cc | 83 | ||||
-rw-r--r-- | libstdc++-v3/testsuite/tr1/headers.cc | 2 |
17 files changed, 730 insertions, 417 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 8a2f2fc..218b225 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,31 @@ +2006-03-10 Paolo Carlini <pcarlini@suse.de> + + * include/tr1/cmath: Add atan2 and pow bits; add using declarations. + * include/tr1/math.h: Add using declarations. + * include/tr1/complex: Add using declarations. + * testsuite/tr1/8_c_compatibility/cmath/functions.cc: Fully + qualify calls. + * testsuite/tr1/8_c_compatibility/cmath/overloads.cc: Likewise; + add atan2 and pow bits. + * testsuite/tr1/8_c_compatibility/complex/overloads_float.cc: Likewise. + * testsuite/tr1/8_c_compatibility/complex/overloads_int.cc: Likewise; + adjust polar bits. + + * acinclude.m4 ([GLIBCXX_CHECK_C99_TR1]): Add checks for double_t + and float_t typedefs. + * include/tr1/cmath: Add double_t and float_t. + * testsuite/tr1/8_c_compatibility/cmath/types.cc: New. + + * include/tr1/ctgmath: New. + * include/tr1/tgmath.h: Likewise. + * include/Makefile.am: Add. + * testsuite/tr1/headers.cc: Update. + + * include/Makefile.in: Regenerate. + * configure: Likewise. + + * docs/html/ext/tr1.html: Update. + 2006-03-08 Paolo Carlini <pcarlini@suse.de> Implement the resolution of DR 455, [DR]. diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4 index 4dc38b8..fbfb3f7 100644 --- a/libstdc++-v3/acinclude.m4 +++ b/libstdc++-v3/acinclude.m4 @@ -1194,7 +1194,9 @@ AC_DEFUN([GLIBCXX_CHECK_C99_TR1], [ AC_MSG_CHECKING([for ISO C99 support to TR1 in <math.h>]) AC_CACHE_VAL(ac_c99_math_tr1, [ AC_TRY_COMPILE([#include <math.h>], - [acosh(0.0); + [typedef double_t my_double_t; + typedef float_t my_float_t; + acosh(0.0); acoshf(0.0f); acoshl(0.0l); asinh(0.0); diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure index 9afb94d..fd58813 100755 --- a/libstdc++-v3/configure +++ b/libstdc++-v3/configure @@ -30651,7 +30651,9 @@ cat >>conftest.$ac_ext <<_ACEOF int main () { -acosh(0.0); +typedef double_t my_double_t; + typedef float_t my_float_t; + acosh(0.0); acoshf(0.0f); acoshl(0.0l); asinh(0.0); diff --git a/libstdc++-v3/docs/html/ext/tr1.html b/libstdc++-v3/docs/html/ext/tr1.html index dcce473..d416e3f 100644 --- a/libstdc++-v3/docs/html/ext/tr1.html +++ b/libstdc++-v3/docs/html/ext/tr1.html @@ -1790,7 +1790,7 @@ release. <td></td> <td></td> <td>missing</td> - <td></td> + <td>DR 551</td> </tr> <tr> <td>8.3</td> @@ -1798,7 +1798,7 @@ release. <td></td> <td></td> <td>missing</td> - <td></td> + <td>DR 551</td> </tr> <tr> <td>8.4</td> @@ -1918,7 +1918,7 @@ release. <td>done</td> <td></td> <td></td> - <td>abs, div: issue with _Longlong</td> + <td>DR 557</td> </tr> <tr> <td>8.11.2</td> @@ -1963,9 +1963,9 @@ release. <tr> <td>8.16</td> <td>Additions to header <code><cmath></code></td> + <td>done</td> <td></td> <td></td> - <td>missing</td> <td></td> </tr> <tr> @@ -1995,17 +1995,17 @@ release. <tr> <td>8.16.4</td> <td>Additional overloads</td> + <td>done</td> <td></td> <td></td> - <td>missing</td> - <td></td> + <td>DR 568; DR 550</td> </tr> <tr> <td>8.17</td> <td>Additions to header <code><math.h></code></td> + <td>done</td> <td></td> <td></td> - <td>missing</td> <td></td> </tr> <tr> @@ -2163,18 +2163,18 @@ release. <tr> <td>8.27</td> <td>Header <code><ctgmath></code></td> + <td>done</td> <td></td> <td></td> - <td>missing</td> - <td></td> + <td>DR 551</td> </tr> <tr> <td>8.28</td> <td>Header <code><tgmath.h></code></td> + <td>done</td> <td></td> <td></td> - <td>missing</td> - <td></td> + <td>DR 551</td> </tr> <tr> <td>8.29</td> @@ -2307,7 +2307,7 @@ permitted in any medium, provided this notice is preserved. <table width="100%" border="0"> <tr> <td> - <!-- IGNORE DIFF -->Last modified 2006-02-26 + <!-- IGNORE DIFF -->Last modified 2006-03-10 </td> <td align="right" valign="bottom"> <a href="http://validator.w3.org/check/referer"> diff --git a/libstdc++-v3/include/Makefile.am b/libstdc++-v3/include/Makefile.am index 0d179c9..37538b4 100644 --- a/libstdc++-v3/include/Makefile.am +++ b/libstdc++-v3/include/Makefile.am @@ -497,6 +497,7 @@ tr1_headers = \ ${tr1_srcdir}/cstdint \ ${tr1_srcdir}/cstdio \ ${tr1_srcdir}/cstdlib \ + ${tr1_srcdir}/ctgmath \ ${tr1_srcdir}/ctime \ ${tr1_srcdir}/ctype.h \ ${tr1_srcdir}/cwchar \ @@ -519,6 +520,7 @@ tr1_headers = \ ${tr1_srcdir}/stdint.h \ ${tr1_srcdir}/stdio.h \ ${tr1_srcdir}/stdlib.h \ + ${tr1_srcdir}/tgmath.h \ ${tr1_srcdir}/tuple \ ${tr1_srcdir}/tuple_iterate.h \ ${tr1_srcdir}/type_traits \ diff --git a/libstdc++-v3/include/Makefile.in b/libstdc++-v3/include/Makefile.in index c749a2c..7e2f744 100644 --- a/libstdc++-v3/include/Makefile.in +++ b/libstdc++-v3/include/Makefile.in @@ -716,6 +716,7 @@ tr1_headers = \ ${tr1_srcdir}/cstdint \ ${tr1_srcdir}/cstdio \ ${tr1_srcdir}/cstdlib \ + ${tr1_srcdir}/ctgmath \ ${tr1_srcdir}/ctime \ ${tr1_srcdir}/ctype.h \ ${tr1_srcdir}/cwchar \ @@ -738,6 +739,7 @@ tr1_headers = \ ${tr1_srcdir}/stdint.h \ ${tr1_srcdir}/stdio.h \ ${tr1_srcdir}/stdlib.h \ + ${tr1_srcdir}/tgmath.h \ ${tr1_srcdir}/tuple \ ${tr1_srcdir}/tuple_iterate.h \ ${tr1_srcdir}/type_traits \ diff --git a/libstdc++-v3/include/tr1/cmath b/libstdc++-v3/include/tr1/cmath index 0bde057..74b4071 100644 --- a/libstdc++-v3/include/tr1/cmath +++ b/libstdc++-v3/include/tr1/cmath @@ -146,11 +146,35 @@ #undef truncf #undef truncl +// Workaround for c++/21682. +namespace __gnu_internal +{ + template<typename _Tp, typename _Up> + inline typename + std::__enable_if<typename std::tr1::__promote_2<_Tp, _Up>::__type, + (std::__is_floating<_Tp>::__value + || std::__is_floating<_Up>::__value)>::__type + atan2(_Tp __y, _Up __x) + { + typedef typename std::tr1::__promote_2<_Tp, _Up>::__type __type; + return std::atan2(__type(__y), __type(__x)); + } +} + +#endif + // namespace std::tr1 namespace std { _GLIBCXX_BEGIN_NAMESPACE(tr1) +#if _GLIBCXX_USE_C99_MATH_TR1 + + // types + using ::double_t; + using ::float_t; + + // functions using ::acosh; using ::acoshf; using ::acoshl; @@ -291,18 +315,13 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) using ::truncf; using ::truncl; -_GLIBCXX_END_NAMESPACE -} - #endif -// namespace std::tr1 -namespace std -{ -_GLIBCXX_BEGIN_NAMESPACE(tr1) - #if _GLIBCXX_USE_C99_MATH #if !_GLIBCXX_USE_C99_FP_MACROS_DYNAMIC + + /// @brief Function template definitions [8.16.3]. + // using std::signbit; using std::fpclassify; @@ -325,6 +344,8 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) /// @brief Additional overloads [8.16.4]. // + using std::acos; + inline float acosh(float __x) { return __builtin_acoshf(__x); } @@ -341,6 +362,8 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) return acosh(__type(__x)); } + using std::asin; + inline float asinh(float __x) { return __builtin_asinhf(__x); } @@ -357,6 +380,12 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) return asinh(__type(__x)); } + using std::atan; + using std::atan2; + + // Workaround for c++/21682. + using __gnu_internal::atan2; + inline float atanh(float __x) { return __builtin_atanhf(__x); } @@ -389,6 +418,8 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) return cbrt(__type(__x)); } + using std::ceil; + inline float copysign(float __x, float __y) { return __builtin_copysignf(__x, __y); } @@ -405,6 +436,9 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) return copysign(__type(__x), __type(__y)); } + using std::cos; + using std::cosh; + inline float erf(float __x) { return __builtin_erff(__x); } @@ -437,6 +471,8 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) return erfc(__type(__x)); } + using std::exp; + inline float exp2(float __x) { return __builtin_exp2f(__x); } @@ -469,6 +505,8 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) return expm1(__type(__x)); } + using std::fabs; + inline float fdim(float __x, float __y) { return __builtin_fdimf(__x, __y); } @@ -485,6 +523,8 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) return fdim(__type(__x), __type(__y)); } + using std::floor; + inline float fma(float __x, float __y, float __z) { return __builtin_fmaf(__x, __y, __z); } @@ -533,6 +573,9 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) return fmin(__type(__x), __type(__y)); } + using std::fmod; + using std::frexp; + inline float hypot(float __x, float __y) { return __builtin_hypotf(__x, __y); } @@ -565,6 +608,8 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) return ilogb(__type(__x)); } + using std::ldexp; + inline float lgamma(float __x) { return __builtin_lgammaf(__x); } @@ -613,6 +658,9 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) return llround(__type(__x)); } + using std::log; + using std::log10; + inline float log1p(float __x) { return __builtin_log1pf(__x); } @@ -629,6 +677,7 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) return log1p(__type(__x)); } + // DR 568. inline float log2(float __x) { return __builtin_log2f(__x); } @@ -741,6 +790,17 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) return nexttoward(__type(__x), __y); } + using std::pow; + + // DR 550. + template<typename _Tp, typename _Up> + inline typename __promote_2<_Tp, _Up>::__type + pow(_Tp __x, _Up __y) + { + typedef typename __promote_2<_Tp, _Up>::__type __type; + return pow(__type(__x), __type(__y)); + } + inline float remainder(float __x, float __y) { return __builtin_remainderf(__x, __y); } @@ -837,6 +897,12 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) return scalbn(__type(__x), __ex); } + using std::sin; + using std::sinh; + using std::sqrt; + using std::tan; + using std::tanh; + inline float tgamma(float __x) { return __builtin_tgammaf(__x); } diff --git a/libstdc++-v3/include/tr1/complex b/libstdc++-v3/include/tr1/complex index 1ba6157..4192b53 100644 --- a/libstdc++-v3/include/tr1/complex +++ b/libstdc++-v3/include/tr1/complex @@ -325,6 +325,8 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) }; + using std::arg; + template<typename _Tp> inline typename __promote<_Tp>::__type arg(_Tp __x) @@ -333,16 +335,22 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) return std::arg(std::complex<__type>(__x)); } + using std::conj; + template<typename _Tp> inline std::complex<typename __promote<_Tp>::__type> conj(_Tp __x) { return __x; } + using std::imag; + template<typename _Tp> inline typename __promote<_Tp>::__type imag(_Tp) { return _Tp(); } + using std::norm; + template<typename _Tp> inline typename __promote<_Tp>::__type norm(_Tp __x) @@ -351,6 +359,8 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) return __type(__x) * __type(__x); } + using std::polar; + template<typename _Tp, typename _Up> inline std::complex<typename __promote_2<_Tp, _Up>::__type> polar(const _Tp& __rho, const _Up& __theta) @@ -359,6 +369,8 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) return std::polar(__type(__rho), __type(__theta)); } + using std::pow; + template<typename _Tp, typename _Up> inline std::complex<typename __promote_2<_Tp, _Up>::__type> pow(const std::complex<_Tp>& __x, const _Up& __y) @@ -384,6 +396,8 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) std::complex<__type>(__y)); } + using std::real; + template<typename _Tp> inline typename __promote<_Tp>::__type real(_Tp __x) diff --git a/libstdc++-v3/include/tr1/ctgmath b/libstdc++-v3/include/tr1/ctgmath new file mode 100644 index 0000000..9f9132f --- /dev/null +++ b/libstdc++-v3/include/tr1/ctgmath @@ -0,0 +1,39 @@ +// TR1 ctgmath -*- C++ -*- + +// Copyright (C) 2006 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +/** @file + * This is a TR1 C++ Library header. + */ + +#ifndef _TR1_CTGMATH +#define _TR1_CTGMATH 1 + +#include <tr1/cmath> + +#endif diff --git a/libstdc++-v3/include/tr1/math.h b/libstdc++-v3/include/tr1/math.h index a0dd24b..0a3e08b 100644 --- a/libstdc++-v3/include/tr1/math.h +++ b/libstdc++-v3/include/tr1/math.h @@ -36,4 +36,64 @@ #include <tr1/cmath> +#if _GLIBCXX_USE_C99_MATH_TR1 + +using std::tr1::acos; +using std::tr1::acosh; +using std::tr1::asin; +using std::tr1::asinh; +using std::tr1::atan; +using std::tr1::atan2; +using std::tr1::atanh; +using std::tr1::cbrt; +using std::tr1::ceil; +using std::tr1::copysign; +using std::tr1::cos; +using std::tr1::cosh; +using std::tr1::erf; +using std::tr1::erfc; +using std::tr1::exp; +using std::tr1::exp2; +using std::tr1::expm1; +using std::tr1::fabs; +using std::tr1::fdim; +using std::tr1::floor; +using std::tr1::fma; +using std::tr1::fmax; +using std::tr1::fmin; +using std::tr1::fmod; +using std::tr1::frexp; +using std::tr1::hypot; +using std::tr1::ilogb; +using std::tr1::ldexp; +using std::tr1::lgamma; +using std::tr1::llrint; +using std::tr1::llround; +using std::tr1::log; +using std::tr1::log10; +using std::tr1::log1p; +using std::tr1::log2; +using std::tr1::logb; +using std::tr1::lrint; +using std::tr1::lround; +using std::tr1::nearbyint; +using std::tr1::nextafter; +using std::tr1::nexttoward; +using std::tr1::pow; +using std::tr1::remainder; +using std::tr1::remquo; +using std::tr1::rint; +using std::tr1::round; +using std::tr1::scalbln; +using std::tr1::scalbn; +using std::tr1::sin; +using std::tr1::sinh; +using std::tr1::sqrt; +using std::tr1::tan; +using std::tr1::tanh; +using std::tr1::tgamma; +using std::tr1::trunc; + +#endif + #endif diff --git a/libstdc++-v3/include/tr1/tgmath.h b/libstdc++-v3/include/tr1/tgmath.h new file mode 100644 index 0000000..cfc0d58 --- /dev/null +++ b/libstdc++-v3/include/tr1/tgmath.h @@ -0,0 +1,39 @@ +// TR1 tgmath.h -*- C++ -*- + +// Copyright (C) 2006 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +/** @file + * This is a TR1 C++ Library header. + */ + +#ifndef _TR1_TGMATH_H +#define _TR1_TGMATH_H 1 + +#include <tr1/ctgmath> + +#endif diff --git a/libstdc++-v3/testsuite/tr1/8_c_compatibility/cmath/functions.cc b/libstdc++-v3/testsuite/tr1/8_c_compatibility/cmath/functions.cc index a0949fa..3bb6d9d 100644 --- a/libstdc++-v3/testsuite/tr1/8_c_compatibility/cmath/functions.cc +++ b/libstdc++-v3/testsuite/tr1/8_c_compatibility/cmath/functions.cc @@ -43,145 +43,145 @@ void test01() long lret; long long llret; - ret = acosh(d0); - fret = acoshf(f0); - ldret = acoshl(ld0); + ret = std::tr1::acosh(d0); + fret = std::tr1::acoshf(f0); + ldret = std::tr1::acoshl(ld0); - ret = asinh(d0); - fret = asinhf(f0); - ldret = asinhl(ld0); + ret = std::tr1::asinh(d0); + fret = std::tr1::asinhf(f0); + ldret = std::tr1::asinhl(ld0); - ret = atanh(d0); - fret = atanhf(f0); - ldret = atanhl(ld0); + ret = std::tr1::atanh(d0); + fret = std::tr1::atanhf(f0); + ldret = std::tr1::atanhl(ld0); - ret = cbrt(d0); - fret = cbrtf(f0); - ldret = cbrtl(ld0); + ret = std::tr1::cbrt(d0); + fret = std::tr1::cbrtf(f0); + ldret = std::tr1::cbrtl(ld0); - ret = copysign(d0, d0); - fret = copysignf(f0, f0); - ldret = copysignl(ld0, ld0); + ret = std::tr1::copysign(d0, d0); + fret = std::tr1::copysignf(f0, f0); + ldret = std::tr1::copysignl(ld0, ld0); - ret = erf(d0); - fret = erff(f0); - ldret = erfl(ld0); + ret = std::tr1::erf(d0); + fret = std::tr1::erff(f0); + ldret = std::tr1::erfl(ld0); - ret = erfc(d0); - fret = erfcf(f0); - ldret = erfcl(ld0); + ret = std::tr1::erfc(d0); + fret = std::tr1::erfcf(f0); + ldret = std::tr1::erfcl(ld0); - ret = exp2(d0); - fret = exp2f(f0); - ldret = exp2l(ld0); + ret = std::tr1::exp2(d0); + fret = std::tr1::exp2f(f0); + ldret = std::tr1::exp2l(ld0); - ret = expm1(d0); - fret = expm1f(f0); - ldret = expm1l(ld0); + ret = std::tr1::expm1(d0); + fret = std::tr1::expm1f(f0); + ldret = std::tr1::expm1l(ld0); - ret = fdim(d0, d0); - fret = fdimf(f0, f0); - ldret = fdiml(ld0, ld0); + ret = std::tr1::fdim(d0, d0); + fret = std::tr1::fdimf(f0, f0); + ldret = std::tr1::fdiml(ld0, ld0); - ret = fma(d0, d0, d0); - fret = fmaf(f0, f0, f0); - ldret = fmal(ld0, ld0, ld0); + ret = std::tr1::fma(d0, d0, d0); + fret = std::tr1::fmaf(f0, f0, f0); + ldret = std::tr1::fmal(ld0, ld0, ld0); - ret = fmax(d0, d0); - fret = fmaxf(f0, f0); - ldret = fmaxl(ld0, ld0); + ret = std::tr1::fmax(d0, d0); + fret = std::tr1::fmaxf(f0, f0); + ldret = std::tr1::fmaxl(ld0, ld0); - ret = fmin(d0, d0); - fret = fminf(f0, f0); - ldret = fminl(ld0, ld0); + ret = std::tr1::fmin(d0, d0); + fret = std::tr1::fminf(f0, f0); + ldret = std::tr1::fminl(ld0, ld0); - ret = hypot(d0, d0); - fret = hypotf(f0, f0); - ldret = hypotl(ld0, ld0); + ret = std::tr1::hypot(d0, d0); + fret = std::tr1::hypotf(f0, f0); + ldret = std::tr1::hypotl(ld0, ld0); - iret = ilogb(d0); - iret = ilogbf(f0); - iret = ilogbl(ld0); + iret = std::tr1::ilogb(d0); + iret = std::tr1::ilogbf(f0); + iret = std::tr1::ilogbl(ld0); - ret = lgamma(d0); - fret = lgammaf(f0); - ldret = lgammal(ld0); + ret = std::tr1::lgamma(d0); + fret = std::tr1::lgammaf(f0); + ldret = std::tr1::lgammal(ld0); - llret = llrint(d0); - llret = llrintf(f0); - llret = llrintl(ld0); + llret = std::tr1::llrint(d0); + llret = std::tr1::llrintf(f0); + llret = std::tr1::llrintl(ld0); - llret = llround(d0); - llret = llroundf(f0); - llret = llroundl(ld0); + llret = std::tr1::llround(d0); + llret = std::tr1::llroundf(f0); + llret = std::tr1::llroundl(ld0); - ret = log1p(d0); - fret = log1pf(f0); - ldret = log1pl(ld0); + ret = std::tr1::log1p(d0); + fret = std::tr1::log1pf(f0); + ldret = std::tr1::log1pl(ld0); - ret = log2(d0); - fret = log2f(f0); - ldret = log2l(ld0); + ret = std::tr1::log2(d0); + fret = std::tr1::log2f(f0); + ldret = std::tr1::log2l(ld0); - ret = logb(d0); - fret = logbf(f0); - ldret = logbl(ld0); + ret = std::tr1::logb(d0); + fret = std::tr1::logbf(f0); + ldret = std::tr1::logbl(ld0); - lret = lrint(d0); - lret = lrintf(f0); - lret = lrintl(ld0); + lret = std::tr1::lrint(d0); + lret = std::tr1::lrintf(f0); + lret = std::tr1::lrintl(ld0); - lret = lround(d0); - lret = lroundf(f0); - lret = lroundl(ld0); + lret = std::tr1::lround(d0); + lret = std::tr1::lroundf(f0); + lret = std::tr1::lroundl(ld0); - ret = nan(str); - fret = nanf(str); - ldret = nanl(str); + ret = std::tr1::nan(str); + fret = std::tr1::nanf(str); + ldret = std::tr1::nanl(str); - ret = nearbyint(d0); - fret = nearbyintf(f0); - ldret = nearbyintl(ld0); + ret = std::tr1::nearbyint(d0); + fret = std::tr1::nearbyintf(f0); + ldret = std::tr1::nearbyintl(ld0); - ret = nextafter(d0, d0); - fret = nextafterf(f0, f0); - ldret = nextafterl(ld0, ld0); + ret = std::tr1::nextafter(d0, d0); + fret = std::tr1::nextafterf(f0, f0); + ldret = std::tr1::nextafterl(ld0, ld0); - ret = nexttoward(d0, ld0); - fret = nexttowardf(f0, ld0); - ldret = nexttowardl(ld0, ld0); + ret = std::tr1::nexttoward(d0, ld0); + fret = std::tr1::nexttowardf(f0, ld0); + ldret = std::tr1::nexttowardl(ld0, ld0); - ret = remainder(d0, d0); - fret = remainderf(f0, f0); - ldret = remainderl(ld0, ld0); + ret = std::tr1::remainder(d0, d0); + fret = std::tr1::remainderf(f0, f0); + ldret = std::tr1::remainderl(ld0, ld0); - ret = remquo(d0, d0, pquo); - fret = remquo(f0, f0, pquo); - ldret = remquo(ld0, ld0, pquo); + ret = std::tr1::remquo(d0, d0, pquo); + fret = std::tr1::remquo(f0, f0, pquo); + ldret = std::tr1::remquo(ld0, ld0, pquo); - ret = rint(d0); - fret = rintf(f0); - ldret = rintl(ld0); + ret = std::tr1::rint(d0); + fret = std::tr1::rintf(f0); + ldret = std::tr1::rintl(ld0); - ret = round(d0); - fret = roundf(f0); - ldret = roundl(ld0); + ret = std::tr1::round(d0); + fret = std::tr1::roundf(f0); + ldret = std::tr1::roundl(ld0); - ret = scalbln(d0, lex); - fret = scalblnf(f0, lex); - ldret = scalblnl(ld0, lex); + ret = std::tr1::scalbln(d0, lex); + fret = std::tr1::scalblnf(f0, lex); + ldret = std::tr1::scalblnl(ld0, lex); - ret = scalbn(d0, ex); - fret = scalbnf(f0, ex); - ldret = scalbnl(ld0, ex); + ret = std::tr1::scalbn(d0, ex); + fret = std::tr1::scalbnf(f0, ex); + ldret = std::tr1::scalbnl(ld0, ex); - ret = tgamma(d0); - fret = tgammaf(f0); - ldret = tgammal(ld0); + ret = std::tr1::tgamma(d0); + fret = std::tr1::tgammaf(f0); + ldret = std::tr1::tgammal(ld0); - ret = trunc(d0); - fret = truncf(f0); - ldret = truncl(ld0); + ret = std::tr1::trunc(d0); + fret = std::tr1::truncf(f0); + ldret = std::tr1::truncl(ld0); #endif } diff --git a/libstdc++-v3/testsuite/tr1/8_c_compatibility/cmath/overloads.cc b/libstdc++-v3/testsuite/tr1/8_c_compatibility/cmath/overloads.cc index e54a8e3..e9253400 100644 --- a/libstdc++-v3/testsuite/tr1/8_c_compatibility/cmath/overloads.cc +++ b/libstdc++-v3/testsuite/tr1/8_c_compatibility/cmath/overloads.cc @@ -29,7 +29,6 @@ void test01() { #if _GLIBCXX_USE_C99_MATH_TR1 - using namespace std::tr1; using namespace __gnu_test; double d0 = 0.0; @@ -40,202 +39,222 @@ void test01() long lex = 0l; int ex = 0; - check_ret_type<double>(acosh(d0)); - check_ret_type<float>(acosh(f0)); - check_ret_type<long double>(acosh(ld0)); - check_ret_type<double>(acosh(i0)); - - check_ret_type<double>(asinh(d0)); - check_ret_type<float>(asinh(f0)); - check_ret_type<long double>(asinh(ld0)); - check_ret_type<double>(asinh(i0)); - - check_ret_type<double>(atanh(d0)); - check_ret_type<float>(atanh(f0)); - check_ret_type<long double>(atanh(ld0)); - check_ret_type<double>(atanh(i0)); - - check_ret_type<double>(cbrt(d0)); - check_ret_type<float>(cbrt(f0)); - check_ret_type<long double>(cbrt(ld0)); - check_ret_type<double>(cbrt(i0)); - - check_ret_type<double>(copysign(d0, d0)); - check_ret_type<double>(copysign(d0, f0)); - check_ret_type<float>(copysign(f0, f0)); - check_ret_type<long double>(copysign(ld0, ld0)); - check_ret_type<long double>(copysign(ld0, d0)); - check_ret_type<double>(copysign(i0, i0)); - check_ret_type<double>(copysign(d0, i0)); - - check_ret_type<double>(erf(d0)); - check_ret_type<float>(erf(f0)); - check_ret_type<long double>(erf(ld0)); - check_ret_type<double>(erf(i0)); - - check_ret_type<double>(erfc(d0)); - check_ret_type<float>(erfc(f0)); - check_ret_type<long double>(erfc(ld0)); - check_ret_type<double>(erfc(i0)); - - check_ret_type<double>(exp2(d0)); - check_ret_type<float>(exp2(f0)); - check_ret_type<long double>(exp2(ld0)); - check_ret_type<double>(exp2(i0)); - - check_ret_type<double>(expm1(d0)); - check_ret_type<float>(expm1(f0)); - check_ret_type<long double>(expm1(ld0)); - check_ret_type<double>(expm1(i0)); - - check_ret_type<double>(fdim(d0, d0)); - check_ret_type<double>(fdim(d0, f0)); - check_ret_type<float>(fdim(f0, f0)); - check_ret_type<long double>(fdim(ld0, ld0)); - check_ret_type<long double>(fdim(ld0, d0)); - check_ret_type<double>(fdim(i0, i0)); - check_ret_type<double>(fdim(d0, i0)); - - check_ret_type<double>(fma(d0, d0, d0)); - check_ret_type<double>(fma(d0, f0, d0)); - check_ret_type<float>(fma(f0, f0, f0)); - check_ret_type<long double>(fma(ld0, ld0, ld0)); - check_ret_type<long double>(fma(ld0, d0, f0)); - check_ret_type<double>(fma(i0, i0, i0)); - check_ret_type<double>(fma(d0, i0, f0)); - - check_ret_type<double>(fmax(d0, d0)); - check_ret_type<double>(fmax(d0, f0)); - check_ret_type<float>(fmax(f0, f0)); - check_ret_type<long double>(fmax(ld0, ld0)); - check_ret_type<long double>(fmax(ld0, d0)); - check_ret_type<double>(fmax(i0, i0)); - check_ret_type<double>(fmax(d0, i0)); - - check_ret_type<double>(fmin(d0, d0)); - check_ret_type<double>(fmin(d0, f0)); - check_ret_type<float>(fmin(f0, f0)); - check_ret_type<long double>(fmin(ld0, ld0)); - check_ret_type<long double>(fmin(ld0, d0)); - check_ret_type<double>(fmin(i0, i0)); - check_ret_type<double>(fmin(d0, i0)); - - check_ret_type<double>(hypot(d0, d0)); - check_ret_type<double>(hypot(d0, f0)); - check_ret_type<float>(hypot(f0, f0)); - check_ret_type<long double>(hypot(ld0, ld0)); - check_ret_type<long double>(hypot(ld0, d0)); - check_ret_type<double>(hypot(i0, i0)); - check_ret_type<double>(hypot(d0, i0)); - - check_ret_type<int>(ilogb(d0)); - check_ret_type<int>(ilogb(f0)); - check_ret_type<int>(ilogb(ld0)); - check_ret_type<int>(ilogb(i0)); - - check_ret_type<double>(lgamma(d0)); - check_ret_type<float>(lgamma(f0)); - check_ret_type<long double>(lgamma(ld0)); - check_ret_type<double>(lgamma(i0)); - - check_ret_type<long long>(llrint(d0)); - check_ret_type<long long>(llrint(f0)); - check_ret_type<long long>(llrint(ld0)); - check_ret_type<long long>(llrint(i0)); - - check_ret_type<long long>(llround(d0)); - check_ret_type<long long>(llround(f0)); - check_ret_type<long long>(llround(ld0)); - check_ret_type<long long>(llround(i0)); - - check_ret_type<double>(log1p(d0)); - check_ret_type<float>(log1p(f0)); - check_ret_type<long double>(log1p(ld0)); - check_ret_type<double>(log1p(i0)); - - check_ret_type<double>(log2(d0)); - check_ret_type<float>(log2(f0)); - check_ret_type<long double>(log2(ld0)); - check_ret_type<double>(log2(i0)); - - check_ret_type<double>(logb(d0)); - check_ret_type<float>(logb(f0)); - check_ret_type<long double>(logb(ld0)); - check_ret_type<double>(logb(i0)); - - check_ret_type<long>(lrint(d0)); - check_ret_type<long>(lrint(f0)); - check_ret_type<long>(lrint(ld0)); - check_ret_type<long>(lrint(i0)); - - check_ret_type<long>(lround(d0)); - check_ret_type<long>(lround(f0)); - check_ret_type<long>(lround(ld0)); - check_ret_type<long>(lround(i0)); - - check_ret_type<double>(nearbyint(d0)); - check_ret_type<float>(nearbyint(f0)); - check_ret_type<long double>(nearbyint(ld0)); - check_ret_type<double>(nearbyint(i0)); - - check_ret_type<double>(nextafter(d0, d0)); - check_ret_type<double>(nextafter(d0, f0)); - check_ret_type<float>(nextafter(f0, f0)); - check_ret_type<long double>(nextafter(ld0, ld0)); - check_ret_type<long double>(nextafter(ld0, d0)); - check_ret_type<double>(nextafter(i0, i0)); - check_ret_type<double>(nextafter(d0, i0)); - - check_ret_type<double>(nexttoward(d0, ld0)); - check_ret_type<float>(nexttoward(f0, ld0)); - check_ret_type<long double>(nexttoward(ld0, ld0)); - check_ret_type<double>(nexttoward(i0, ld0)); - - check_ret_type<double>(remainder(d0, d0)); - check_ret_type<double>(remainder(d0, f0)); - check_ret_type<float>(remainder(f0, f0)); - check_ret_type<long double>(remainder(ld0, ld0)); - check_ret_type<long double>(remainder(ld0, d0)); - check_ret_type<double>(remainder(i0, i0)); - check_ret_type<double>(remainder(d0, i0)); - - check_ret_type<double>(remquo(d0, d0, pquo)); - check_ret_type<double>(remquo(d0, f0, pquo)); - check_ret_type<float>(remquo(f0, f0, pquo)); - check_ret_type<long double>(remquo(ld0, ld0, pquo)); - check_ret_type<long double>(remquo(ld0, d0, pquo)); - check_ret_type<double>(remquo(i0, i0, pquo)); - check_ret_type<double>(remquo(d0, i0, pquo)); - - check_ret_type<double>(rint(d0)); - check_ret_type<float>(rint(f0)); - check_ret_type<long double>(rint(ld0)); - check_ret_type<double>(rint(i0)); - - check_ret_type<double>(round(d0)); - check_ret_type<float>(round(f0)); - check_ret_type<long double>(round(ld0)); - check_ret_type<double>(round(i0)); - - check_ret_type<double>(scalbln(d0, lex)); - check_ret_type<float>(scalbln(f0, lex)); - check_ret_type<long double>(scalbln(ld0, lex)); - check_ret_type<double>(scalbln(i0, lex)); - - check_ret_type<double>(scalbn(d0, ex)); - check_ret_type<float>(scalbn(f0, ex)); - check_ret_type<long double>(scalbn(ld0, ex)); - check_ret_type<double>(scalbn(i0, ex)); - - check_ret_type<double>(tgamma(d0)); - check_ret_type<float>(tgamma(f0)); - check_ret_type<long double>(tgamma(ld0)); - check_ret_type<double>(tgamma(i0)); - - check_ret_type<double>(trunc(d0)); - check_ret_type<float>(trunc(f0)); - check_ret_type<long double>(trunc(ld0)); - check_ret_type<double>(trunc(i0)); + check_ret_type<double>(std::tr1::atan2(d0, d0)); + check_ret_type<double>(std::tr1::atan2(d0, f0)); + check_ret_type<float>(std::tr1::atan2(f0, f0)); + check_ret_type<long double>(std::tr1::atan2(ld0, ld0)); + check_ret_type<long double>(std::tr1::atan2(ld0, d0)); + check_ret_type<double>(std::tr1::atan2(i0, i0)); + check_ret_type<double>(std::tr1::atan2(d0, i0)); + + check_ret_type<double>(std::tr1::acosh(d0)); + check_ret_type<float>(std::tr1::acosh(f0)); + check_ret_type<long double>(std::tr1::acosh(ld0)); + check_ret_type<double>(std::tr1::acosh(i0)); + + check_ret_type<double>(std::tr1::asinh(d0)); + check_ret_type<float>(std::tr1::asinh(f0)); + check_ret_type<long double>(std::tr1::asinh(ld0)); + check_ret_type<double>(std::tr1::asinh(i0)); + + check_ret_type<double>(std::tr1::atanh(d0)); + check_ret_type<float>(std::tr1::atanh(f0)); + check_ret_type<long double>(std::tr1::atanh(ld0)); + check_ret_type<double>(std::tr1::atanh(i0)); + + check_ret_type<double>(std::tr1::cbrt(d0)); + check_ret_type<float>(std::tr1::cbrt(f0)); + check_ret_type<long double>(std::tr1::cbrt(ld0)); + check_ret_type<double>(std::tr1::cbrt(i0)); + + check_ret_type<double>(std::tr1::copysign(d0, d0)); + check_ret_type<double>(std::tr1::copysign(d0, f0)); + check_ret_type<float>(std::tr1::copysign(f0, f0)); + check_ret_type<long double>(std::tr1::copysign(ld0, ld0)); + check_ret_type<long double>(std::tr1::copysign(ld0, d0)); + check_ret_type<double>(std::tr1::copysign(i0, i0)); + check_ret_type<double>(std::tr1::copysign(d0, i0)); + + check_ret_type<double>(std::tr1::erf(d0)); + check_ret_type<float>(std::tr1::erf(f0)); + check_ret_type<long double>(std::tr1::erf(ld0)); + check_ret_type<double>(std::tr1::erf(i0)); + + check_ret_type<double>(std::tr1::erfc(d0)); + check_ret_type<float>(std::tr1::erfc(f0)); + check_ret_type<long double>(std::tr1::erfc(ld0)); + check_ret_type<double>(std::tr1::erfc(i0)); + + check_ret_type<double>(std::tr1::exp2(d0)); + check_ret_type<float>(std::tr1::exp2(f0)); + check_ret_type<long double>(std::tr1::exp2(ld0)); + check_ret_type<double>(std::tr1::exp2(i0)); + + check_ret_type<double>(std::tr1::expm1(d0)); + check_ret_type<float>(std::tr1::expm1(f0)); + check_ret_type<long double>(std::tr1::expm1(ld0)); + check_ret_type<double>(std::tr1::expm1(i0)); + + check_ret_type<double>(std::tr1::fdim(d0, d0)); + check_ret_type<double>(std::tr1::fdim(d0, f0)); + check_ret_type<float>(std::tr1::fdim(f0, f0)); + check_ret_type<long double>(std::tr1::fdim(ld0, ld0)); + check_ret_type<long double>(std::tr1::fdim(ld0, d0)); + check_ret_type<double>(std::tr1::fdim(i0, i0)); + check_ret_type<double>(std::tr1::fdim(d0, i0)); + + check_ret_type<double>(std::tr1::fma(d0, d0, d0)); + check_ret_type<double>(std::tr1::fma(d0, f0, d0)); + check_ret_type<float>(std::tr1::fma(f0, f0, f0)); + check_ret_type<long double>(std::tr1::fma(ld0, ld0, ld0)); + check_ret_type<long double>(std::tr1::fma(ld0, d0, f0)); + check_ret_type<double>(std::tr1::fma(i0, i0, i0)); + check_ret_type<double>(std::tr1::fma(d0, i0, f0)); + + check_ret_type<double>(std::tr1::fmax(d0, d0)); + check_ret_type<double>(std::tr1::fmax(d0, f0)); + check_ret_type<float>(std::tr1::fmax(f0, f0)); + check_ret_type<long double>(std::tr1::fmax(ld0, ld0)); + check_ret_type<long double>(std::tr1::fmax(ld0, d0)); + check_ret_type<double>(std::tr1::fmax(i0, i0)); + check_ret_type<double>(std::tr1::fmax(d0, i0)); + + check_ret_type<double>(std::tr1::fmin(d0, d0)); + check_ret_type<double>(std::tr1::fmin(d0, f0)); + check_ret_type<float>(std::tr1::fmin(f0, f0)); + check_ret_type<long double>(std::tr1::fmin(ld0, ld0)); + check_ret_type<long double>(std::tr1::fmin(ld0, d0)); + check_ret_type<double>(std::tr1::fmin(i0, i0)); + check_ret_type<double>(std::tr1::fmin(d0, i0)); + + check_ret_type<double>(std::tr1::hypot(d0, d0)); + check_ret_type<double>(std::tr1::hypot(d0, f0)); + check_ret_type<float>(std::tr1::hypot(f0, f0)); + check_ret_type<long double>(std::tr1::hypot(ld0, ld0)); + check_ret_type<long double>(std::tr1::hypot(ld0, d0)); + check_ret_type<double>(std::tr1::hypot(i0, i0)); + check_ret_type<double>(std::tr1::hypot(d0, i0)); + + check_ret_type<int>(std::tr1::ilogb(d0)); + check_ret_type<int>(std::tr1::ilogb(f0)); + check_ret_type<int>(std::tr1::ilogb(ld0)); + check_ret_type<int>(std::tr1::ilogb(i0)); + + check_ret_type<double>(std::tr1::lgamma(d0)); + check_ret_type<float>(std::tr1::lgamma(f0)); + check_ret_type<long double>(std::tr1::lgamma(ld0)); + check_ret_type<double>(std::tr1::lgamma(i0)); + + check_ret_type<long long>(std::tr1::llrint(d0)); + check_ret_type<long long>(std::tr1::llrint(f0)); + check_ret_type<long long>(std::tr1::llrint(ld0)); + check_ret_type<long long>(std::tr1::llrint(i0)); + + check_ret_type<long long>(std::tr1::llround(d0)); + check_ret_type<long long>(std::tr1::llround(f0)); + check_ret_type<long long>(std::tr1::llround(ld0)); + check_ret_type<long long>(std::tr1::llround(i0)); + + check_ret_type<double>(std::tr1::log1p(d0)); + check_ret_type<float>(std::tr1::log1p(f0)); + check_ret_type<long double>(std::tr1::log1p(ld0)); + check_ret_type<double>(std::tr1::log1p(i0)); + + // DR 568. + check_ret_type<double>(std::tr1::log2(d0)); + check_ret_type<float>(std::tr1::log2(f0)); + check_ret_type<long double>(std::tr1::log2(ld0)); + check_ret_type<double>(std::tr1::log2(i0)); + + check_ret_type<double>(std::tr1::logb(d0)); + check_ret_type<float>(std::tr1::logb(f0)); + check_ret_type<long double>(std::tr1::logb(ld0)); + check_ret_type<double>(std::tr1::logb(i0)); + + check_ret_type<long>(std::tr1::lrint(d0)); + check_ret_type<long>(std::tr1::lrint(f0)); + check_ret_type<long>(std::tr1::lrint(ld0)); + check_ret_type<long>(std::tr1::lrint(i0)); + + check_ret_type<long>(std::tr1::lround(d0)); + check_ret_type<long>(std::tr1::lround(f0)); + check_ret_type<long>(std::tr1::lround(ld0)); + check_ret_type<long>(std::tr1::lround(i0)); + + check_ret_type<double>(std::tr1::nearbyint(d0)); + check_ret_type<float>(std::tr1::nearbyint(f0)); + check_ret_type<long double>(std::tr1::nearbyint(ld0)); + check_ret_type<double>(std::tr1::nearbyint(i0)); + + check_ret_type<double>(std::tr1::nextafter(d0, d0)); + check_ret_type<double>(std::tr1::nextafter(d0, f0)); + check_ret_type<float>(std::tr1::nextafter(f0, f0)); + check_ret_type<long double>(std::tr1::nextafter(ld0, ld0)); + check_ret_type<long double>(std::tr1::nextafter(ld0, d0)); + check_ret_type<double>(std::tr1::nextafter(i0, i0)); + check_ret_type<double>(std::tr1::nextafter(d0, i0)); + + check_ret_type<double>(std::tr1::nexttoward(d0, ld0)); + check_ret_type<float>(std::tr1::nexttoward(f0, ld0)); + check_ret_type<long double>(std::tr1::nexttoward(ld0, ld0)); + check_ret_type<double>(std::tr1::nexttoward(i0, ld0)); + + check_ret_type<double>(std::tr1::pow(d0, d0)); + check_ret_type<double>(std::tr1::pow(d0, f0)); + check_ret_type<float>(std::tr1::pow(f0, f0)); + check_ret_type<long double>(std::tr1::pow(ld0, ld0)); + check_ret_type<long double>(std::tr1::pow(ld0, d0)); + check_ret_type<double>(std::tr1::pow(i0, i0)); + check_ret_type<double>(std::tr1::pow(d0, i0)); + // DR 550. + // check_ret_type<double>(std::tr1::pow(f0, i0)); + check_ret_type<float>(std::tr1::pow(f0, i0)); + + check_ret_type<double>(std::tr1::remainder(d0, d0)); + check_ret_type<double>(std::tr1::remainder(d0, f0)); + check_ret_type<float>(std::tr1::remainder(f0, f0)); + check_ret_type<long double>(std::tr1::remainder(ld0, ld0)); + check_ret_type<long double>(std::tr1::remainder(ld0, d0)); + check_ret_type<double>(std::tr1::remainder(i0, i0)); + check_ret_type<double>(std::tr1::remainder(d0, i0)); + + check_ret_type<double>(std::tr1::remquo(d0, d0, pquo)); + check_ret_type<double>(std::tr1::remquo(d0, f0, pquo)); + check_ret_type<float>(std::tr1::remquo(f0, f0, pquo)); + check_ret_type<long double>(std::tr1::remquo(ld0, ld0, pquo)); + check_ret_type<long double>(std::tr1::remquo(ld0, d0, pquo)); + check_ret_type<double>(std::tr1::remquo(i0, i0, pquo)); + check_ret_type<double>(std::tr1::remquo(d0, i0, pquo)); + + check_ret_type<double>(std::tr1::rint(d0)); + check_ret_type<float>(std::tr1::rint(f0)); + check_ret_type<long double>(std::tr1::rint(ld0)); + check_ret_type<double>(std::tr1::rint(i0)); + + check_ret_type<double>(std::tr1::round(d0)); + check_ret_type<float>(std::tr1::round(f0)); + check_ret_type<long double>(std::tr1::round(ld0)); + check_ret_type<double>(std::tr1::round(i0)); + + check_ret_type<double>(std::tr1::scalbln(d0, lex)); + check_ret_type<float>(std::tr1::scalbln(f0, lex)); + check_ret_type<long double>(std::tr1::scalbln(ld0, lex)); + check_ret_type<double>(std::tr1::scalbln(i0, lex)); + + check_ret_type<double>(std::tr1::scalbn(d0, ex)); + check_ret_type<float>(std::tr1::scalbn(f0, ex)); + check_ret_type<long double>(std::tr1::scalbn(ld0, ex)); + check_ret_type<double>(std::tr1::scalbn(i0, ex)); + + check_ret_type<double>(std::tr1::tgamma(d0)); + check_ret_type<float>(std::tr1::tgamma(f0)); + check_ret_type<long double>(std::tr1::tgamma(ld0)); + check_ret_type<double>(std::tr1::tgamma(i0)); + + check_ret_type<double>(std::tr1::trunc(d0)); + check_ret_type<float>(std::tr1::trunc(f0)); + check_ret_type<long double>(std::tr1::trunc(ld0)); + check_ret_type<double>(std::tr1::trunc(i0)); #endif } diff --git a/libstdc++-v3/testsuite/tr1/8_c_compatibility/cmath/types.cc b/libstdc++-v3/testsuite/tr1/8_c_compatibility/cmath/types.cc new file mode 100644 index 0000000..dff4b9d --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/8_c_compatibility/cmath/types.cc @@ -0,0 +1,35 @@ +// { dg-do compile } + +// 2006-03-10 Paolo Carlini <pcarlini@suse.de> +// +// Copyright (C) 2006 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// 8.16 Additions to header <cmath> + +#include <tr1/cmath> + +void test01() +{ +#if _GLIBCXX_USE_C99_MATH_TR1 + + typedef std::tr1::double_t my_double_t; + typedef std::tr1::float_t my_float_t; + +#endif +} diff --git a/libstdc++-v3/testsuite/tr1/8_c_compatibility/complex/overloads_float.cc b/libstdc++-v3/testsuite/tr1/8_c_compatibility/complex/overloads_float.cc index 21f2d75..389f364 100644 --- a/libstdc++-v3/testsuite/tr1/8_c_compatibility/complex/overloads_float.cc +++ b/libstdc++-v3/testsuite/tr1/8_c_compatibility/complex/overloads_float.cc @@ -23,13 +23,11 @@ // 8.1 Additions to header <complex> #include <tr1/complex> -#include <testsuite_hooks.h> #include <testsuite_tr1.h> void test01() { - using namespace std::tr1; - using namespace __gnu_test; + using __gnu_test::check_ret_type; typedef std::complex<float> cmplx_f_type; typedef std::complex<double> cmplx_d_type; @@ -43,63 +41,63 @@ void test01() const cmplx_d_type c_d1(d1, d1); const cmplx_ld_type c_ld1(ld1, ld1); - check_ret_type<float>(arg(f1)); - check_ret_type<double>(arg(d1)); - check_ret_type<long double>(arg(ld1)); + check_ret_type<float>(std::tr1::arg(f1)); + check_ret_type<double>(std::tr1::arg(d1)); + check_ret_type<long double>(std::tr1::arg(ld1)); - check_ret_type<cmplx_f_type>(conj(f1)); - check_ret_type<cmplx_d_type>(conj(d1)); - check_ret_type<cmplx_ld_type>(conj(ld1)); + check_ret_type<cmplx_f_type>(std::tr1::conj(f1)); + check_ret_type<cmplx_d_type>(std::tr1::conj(d1)); + check_ret_type<cmplx_ld_type>(std::tr1::conj(ld1)); - check_ret_type<float>(imag(f1)); - check_ret_type<double>(imag(d1)); - check_ret_type<long double>(imag(ld1)); + check_ret_type<float>(std::tr1::imag(f1)); + check_ret_type<double>(std::tr1::imag(d1)); + check_ret_type<long double>(std::tr1::imag(ld1)); - check_ret_type<float>(norm(f1)); - check_ret_type<double>(norm(d1)); - check_ret_type<long double>(norm(ld1)); + check_ret_type<float>(std::tr1::norm(f1)); + check_ret_type<double>(std::tr1::norm(d1)); + check_ret_type<long double>(std::tr1::norm(ld1)); - check_ret_type<cmplx_f_type>(polar(f1, f1)); - check_ret_type<cmplx_d_type>(polar(d1, f1)); - check_ret_type<cmplx_d_type>(polar(f1, d1)); - check_ret_type<cmplx_d_type>(polar(d1, d1)); - check_ret_type<cmplx_ld_type>(polar(ld1, d1)); - check_ret_type<cmplx_ld_type>(polar(d1, ld1)); - check_ret_type<cmplx_ld_type>(polar(ld1, f1)); - check_ret_type<cmplx_ld_type>(polar(f1, ld1)); - check_ret_type<cmplx_ld_type>(polar(ld1, ld1)); + check_ret_type<cmplx_f_type>(std::tr1::polar(f1, f1)); + check_ret_type<cmplx_d_type>(std::tr1::polar(d1, f1)); + check_ret_type<cmplx_d_type>(std::tr1::polar(f1, d1)); + check_ret_type<cmplx_d_type>(std::tr1::polar(d1, d1)); + check_ret_type<cmplx_ld_type>(std::tr1::polar(ld1, d1)); + check_ret_type<cmplx_ld_type>(std::tr1::polar(d1, ld1)); + check_ret_type<cmplx_ld_type>(std::tr1::polar(ld1, f1)); + check_ret_type<cmplx_ld_type>(std::tr1::polar(f1, ld1)); + check_ret_type<cmplx_ld_type>(std::tr1::polar(ld1, ld1)); - check_ret_type<cmplx_f_type>(pow(c_f1, f1)); - check_ret_type<cmplx_d_type>(pow(c_d1, f1)); - check_ret_type<cmplx_d_type>(pow(c_f1, d1)); - check_ret_type<cmplx_d_type>(pow(c_d1, d1)); - check_ret_type<cmplx_ld_type>(pow(c_ld1, d1)); - check_ret_type<cmplx_ld_type>(pow(c_d1, ld1)); - check_ret_type<cmplx_ld_type>(pow(c_ld1, f1)); - check_ret_type<cmplx_ld_type>(pow(c_f1, ld1)); - check_ret_type<cmplx_ld_type>(pow(c_ld1, ld1)); + check_ret_type<cmplx_f_type>(std::tr1::pow(c_f1, f1)); + check_ret_type<cmplx_d_type>(std::tr1::pow(c_d1, f1)); + check_ret_type<cmplx_d_type>(std::tr1::pow(c_f1, d1)); + check_ret_type<cmplx_d_type>(std::tr1::pow(c_d1, d1)); + check_ret_type<cmplx_ld_type>(std::tr1::pow(c_ld1, d1)); + check_ret_type<cmplx_ld_type>(std::tr1::pow(c_d1, ld1)); + check_ret_type<cmplx_ld_type>(std::tr1::pow(c_ld1, f1)); + check_ret_type<cmplx_ld_type>(std::tr1::pow(c_f1, ld1)); + check_ret_type<cmplx_ld_type>(std::tr1::pow(c_ld1, ld1)); - check_ret_type<cmplx_f_type>(pow(f1, c_f1)); - check_ret_type<cmplx_d_type>(pow(d1, c_f1)); - check_ret_type<cmplx_d_type>(pow(f1, c_d1)); - check_ret_type<cmplx_d_type>(pow(d1, c_d1)); - check_ret_type<cmplx_ld_type>(pow(ld1, c_d1)); - check_ret_type<cmplx_ld_type>(pow(d1, c_ld1)); - check_ret_type<cmplx_ld_type>(pow(ld1, c_f1)); - check_ret_type<cmplx_ld_type>(pow(f1, c_ld1)); - check_ret_type<cmplx_ld_type>(pow(ld1, c_ld1)); + check_ret_type<cmplx_f_type>(std::tr1::pow(f1, c_f1)); + check_ret_type<cmplx_d_type>(std::tr1::pow(d1, c_f1)); + check_ret_type<cmplx_d_type>(std::tr1::pow(f1, c_d1)); + check_ret_type<cmplx_d_type>(std::tr1::pow(d1, c_d1)); + check_ret_type<cmplx_ld_type>(std::tr1::pow(ld1, c_d1)); + check_ret_type<cmplx_ld_type>(std::tr1::pow(d1, c_ld1)); + check_ret_type<cmplx_ld_type>(std::tr1::pow(ld1, c_f1)); + check_ret_type<cmplx_ld_type>(std::tr1::pow(f1, c_ld1)); + check_ret_type<cmplx_ld_type>(std::tr1::pow(ld1, c_ld1)); - check_ret_type<cmplx_f_type>(pow(c_f1, c_f1)); - check_ret_type<cmplx_d_type>(pow(c_d1, c_f1)); - check_ret_type<cmplx_d_type>(pow(c_f1, c_d1)); - check_ret_type<cmplx_d_type>(pow(c_d1, c_d1)); - check_ret_type<cmplx_ld_type>(pow(c_ld1, c_d1)); - check_ret_type<cmplx_ld_type>(pow(c_d1, c_ld1)); - check_ret_type<cmplx_ld_type>(pow(c_ld1, c_f1)); - check_ret_type<cmplx_ld_type>(pow(c_f1, c_ld1)); - check_ret_type<cmplx_ld_type>(pow(c_ld1, c_ld1)); + check_ret_type<cmplx_f_type>(std::tr1::pow(c_f1, c_f1)); + check_ret_type<cmplx_d_type>(std::tr1::pow(c_d1, c_f1)); + check_ret_type<cmplx_d_type>(std::tr1::pow(c_f1, c_d1)); + check_ret_type<cmplx_d_type>(std::tr1::pow(c_d1, c_d1)); + check_ret_type<cmplx_ld_type>(std::tr1::pow(c_ld1, c_d1)); + check_ret_type<cmplx_ld_type>(std::tr1::pow(c_d1, c_ld1)); + check_ret_type<cmplx_ld_type>(std::tr1::pow(c_ld1, c_f1)); + check_ret_type<cmplx_ld_type>(std::tr1::pow(c_f1, c_ld1)); + check_ret_type<cmplx_ld_type>(std::tr1::pow(c_ld1, c_ld1)); - check_ret_type<float>(real(f1)); - check_ret_type<double>(real(d1)); - check_ret_type<long double>(real(ld1)); + check_ret_type<float>(std::tr1::real(f1)); + check_ret_type<double>(std::tr1::real(d1)); + check_ret_type<long double>(std::tr1::real(ld1)); } diff --git a/libstdc++-v3/testsuite/tr1/8_c_compatibility/complex/overloads_int.cc b/libstdc++-v3/testsuite/tr1/8_c_compatibility/complex/overloads_int.cc index 07b2f92..b018351 100644 --- a/libstdc++-v3/testsuite/tr1/8_c_compatibility/complex/overloads_int.cc +++ b/libstdc++-v3/testsuite/tr1/8_c_compatibility/complex/overloads_int.cc @@ -27,8 +27,7 @@ void test01() { bool test __attribute__((unused)) = true; - using namespace std::tr1; - using namespace __gnu_test; + using __gnu_test::check_ret_type; typedef std::complex<float> cmplx_f_type; typedef std::complex<double> cmplx_d_type; @@ -39,57 +38,63 @@ void test01() const double f1 = 1.0f; const double d1 = 1.0; - check_ret_type<double>(arg(i1)); - VERIFY( arg(i1) == arg(double(i1)) ); - VERIFY( arg(i1) == arg(cmplx_d_type(double(i1))) ); + check_ret_type<double>(std::tr1::arg(i1)); + VERIFY( std::tr1::arg(i1) == std::tr1::arg(double(i1)) ); + VERIFY( std::tr1::arg(i1) == std::tr1::arg(cmplx_d_type(double(i1))) ); - check_ret_type<cmplx_d_type>(conj(i1)); - VERIFY( conj(i1) == conj(double(i1)) ); - VERIFY( conj(i1) == conj(cmplx_d_type(double(i1))) ); + check_ret_type<cmplx_d_type>(std::tr1::conj(i1)); + VERIFY( std::tr1::conj(i1) == std::tr1::conj(double(i1)) ); + VERIFY( std::tr1::conj(i1) == std::tr1::conj(cmplx_d_type(double(i1))) ); - check_ret_type<double>(imag(i1)); - VERIFY( imag(i1) == imag(double(i1)) ); - VERIFY( imag(i1) == imag(cmplx_d_type(double(i1))) ); + check_ret_type<double>(std::tr1::imag(i1)); + VERIFY( std::tr1::imag(i1) == std::tr1::imag(double(i1)) ); + VERIFY( std::tr1::imag(i1) == std::tr1::imag(cmplx_d_type(double(i1))) ); - check_ret_type<double>(norm(i1)); - VERIFY( norm(i1) == norm(double(i1)) ); + check_ret_type<double>(std::tr1::norm(i1)); + VERIFY( std::tr1::norm(i1) == std::tr1::norm(double(i1)) ); // std::norm<const complex<>&) is mathematically equivalent to just // this for a real, but the general algorithm goes through std::abs // and a multiplication. - VERIFY( norm(i1) == double(i1) * double(i1) ); + VERIFY( std::tr1::norm(i1) == double(i1) * double(i1) ); + + // NB: The existing std::polar wins and a cmplx_i_type is returned. + // check_ret_type<cmplx_d_type>(std::tr1::polar(i1, i1)); + // VERIFY( std::tr1::polar(i1, i1) + // == std::tr1::polar(double(i1), double(i1)) ); + typedef std::complex<int> cmplx_i_type; + check_ret_type<cmplx_i_type>(std::tr1::polar(i1, i1)); - check_ret_type<cmplx_d_type>(polar(i1, i1)); - VERIFY( polar(i1, i1) == polar(double(i1), double(i1)) ); // NB: According to the letter of 8.1.9/3 the return type should be a // cmplx_d_type, but the existing std::pow(const complex<>&, int) wins. - check_ret_type<cmplx_f_type>(pow(cmplx_f_type(f1, f1), i1)); + // check_ret_type<cmplx_d_type>(std::tr1::pow(cmplx_f_type(f1, f1), i1)); + check_ret_type<cmplx_f_type>(std::tr1::pow(cmplx_f_type(f1, f1), i1)); - check_ret_type<cmplx_d_type>(pow(cmplx_f_type(f1, f1), u1)); - check_ret_type<cmplx_d_type>(pow(cmplx_f_type(f1, f1), l1)); - check_ret_type<cmplx_d_type>(pow(cmplx_d_type(d1, d1), i1)); + check_ret_type<cmplx_d_type>(std::tr1::pow(cmplx_f_type(f1, f1), u1)); + check_ret_type<cmplx_d_type>(std::tr1::pow(cmplx_f_type(f1, f1), l1)); + check_ret_type<cmplx_d_type>(std::tr1::pow(cmplx_d_type(d1, d1), i1)); // See last comment. - // VERIFY( pow(cmplx_d_type(d1, d1), i1) - // == pow(cmplx_d_type(d1, d1), double(i1)) ); - VERIFY( pow(cmplx_d_type(d1, d1), u1) - == pow(cmplx_d_type(d1, d1), double(u1)) ); - VERIFY( pow(cmplx_d_type(d1, d1), l1) - == pow(cmplx_d_type(d1, d1), double(l1)) ); + // VERIFY( std::tr1::pow(cmplx_d_type(d1, d1), i1) + // == std::tr1::pow(cmplx_d_type(d1, d1), double(i1)) ); + VERIFY( std::tr1::pow(cmplx_d_type(d1, d1), u1) + == std::tr1::pow(cmplx_d_type(d1, d1), double(u1)) ); + VERIFY( std::tr1::pow(cmplx_d_type(d1, d1), l1) + == std::tr1::pow(cmplx_d_type(d1, d1), double(l1)) ); - check_ret_type<cmplx_d_type>(pow(i1, cmplx_f_type(f1, f1))); - check_ret_type<cmplx_d_type>(pow(u1, cmplx_f_type(f1, f1))); - check_ret_type<cmplx_d_type>(pow(l1, cmplx_f_type(f1, f1))); - check_ret_type<cmplx_d_type>(pow(i1, cmplx_d_type(d1, d1))); - VERIFY( pow(i1, cmplx_d_type(d1, d1)) - == pow(double(i1), cmplx_d_type(d1, d1)) ); - VERIFY( pow(u1, cmplx_d_type(d1, d1)) - == pow(double(u1), cmplx_d_type(d1, d1)) ); - VERIFY( pow(l1, cmplx_d_type(d1, d1)) - == pow(double(l1), cmplx_d_type(d1, d1)) ); + check_ret_type<cmplx_d_type>(std::tr1::pow(i1, cmplx_f_type(f1, f1))); + check_ret_type<cmplx_d_type>(std::tr1::pow(u1, cmplx_f_type(f1, f1))); + check_ret_type<cmplx_d_type>(std::tr1::pow(l1, cmplx_f_type(f1, f1))); + check_ret_type<cmplx_d_type>(std::tr1::pow(i1, cmplx_d_type(d1, d1))); + VERIFY( std::tr1::pow(i1, cmplx_d_type(d1, d1)) + == std::tr1::pow(double(i1), cmplx_d_type(d1, d1)) ); + VERIFY( std::tr1::pow(u1, cmplx_d_type(d1, d1)) + == std::tr1::pow(double(u1), cmplx_d_type(d1, d1)) ); + VERIFY( std::tr1::pow(l1, cmplx_d_type(d1, d1)) + == std::tr1::pow(double(l1), cmplx_d_type(d1, d1)) ); - check_ret_type<double>(real(i1)); - VERIFY( real(i1) == real(double(i1)) ); - VERIFY( real(i1) == real(cmplx_d_type(double(i1))) ); + check_ret_type<double>(std::tr1::real(i1)); + VERIFY( std::tr1::real(i1) == std::tr1::real(double(i1)) ); + VERIFY( std::tr1::real(i1) == std::tr1::real(cmplx_d_type(double(i1))) ); } int main() diff --git a/libstdc++-v3/testsuite/tr1/headers.cc b/libstdc++-v3/testsuite/tr1/headers.cc index ad77006..0650f53 100644 --- a/libstdc++-v3/testsuite/tr1/headers.cc +++ b/libstdc++-v3/testsuite/tr1/headers.cc @@ -33,6 +33,7 @@ #include <tr1/cstdint> #include <tr1/cstdio> #include <tr1/cstdlib> +#include <tr1/ctgmath> #include <tr1/ctime> #include <tr1/ctype.h> #include <tr1/cwchar> @@ -49,6 +50,7 @@ #include <tr1/stdint.h> #include <tr1/stdio.h> #include <tr1/stdlib.h> +#include <tr1/tgmath.h> #include <tr1/tuple> #include <tr1/type_traits> #include <tr1/unordered_set> |