cmath (abs(_Tp)): Add.

2009-07-23  Paolo Carlini  <paolo.carlini@oracle.com>

	* include/c_std/cmath (abs(_Tp)): Add.
	* include/c_global/cmath (abs(_Tp)): Likewise.
	* testsuite/26_numerics/headers/cmath/overloads.cc: Extend.

From-SVN: r150022
This commit is contained in:
Paolo Carlini 2009-07-23 18:38:22 +00:00 committed by Paolo Carlini
parent 88e18fedad
commit 7cf8aefccf
4 changed files with 43 additions and 6 deletions

View File

@ -1,3 +1,9 @@
2009-07-23 Paolo Carlini <paolo.carlini@oracle.com>
* include/c_std/cmath (abs(_Tp)): Add.
* include/c_global/cmath (abs(_Tp)): Likewise.
* testsuite/26_numerics/headers/cmath/overloads.cc: Extend.
2009-07-23 Paolo Carlini <paolo.carlini@oracle.com>
* doc/html/ext/lwg-closed.html: Update to R65.

View File

@ -102,6 +102,12 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
abs(long double __x)
{ return __builtin_fabsl(__x); }
template<typename _Tp>
inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
double>::__type
abs(_Tp __x)
{ return __builtin_fabs(__x); }
using ::acos;
inline float

View File

@ -93,6 +93,12 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
abs(long double __x)
{ return __builtin_fabsl(__x); }
template<typename _Tp>
inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
double>::__type
abs(_Tp __x)
{ return __builtin_fabs(__x); }
using ::acos;
inline float
@ -120,8 +126,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
{ return __builtin_asinl(__x); }
template<typename _Tp>
inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
double>::__type
inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
double>::__type
asin(_Tp __x)
{ return __builtin_asin(__x); }
@ -136,8 +142,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
{ return __builtin_atanl(__x); }
template<typename _Tp>
inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
double>::__type
inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
double>::__type
atan(_Tp __x)
{ return __builtin_atan(__x); }
@ -293,8 +299,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
template<typename _Tp>
inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
double>::__type
ldexp(_Tp __x, int __exp)
{ return __builtin_ldexp(__x, __exp); }
ldexp(_Tp __x, int __exp)
{ return __builtin_ldexp(__x, __exp); }
using ::log;

View File

@ -1,3 +1,21 @@
// Copyright (C) 2003, 2004, 2005, 2006, 2007, 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/>.
// PR 3181
// Origin: pete@toyon.com
@ -8,6 +26,7 @@ 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);