aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3/include/c_std/std_cmath.h
diff options
context:
space:
mode:
Diffstat (limited to 'libstdc++-v3/include/c_std/std_cmath.h')
-rw-r--r--libstdc++-v3/include/c_std/std_cmath.h120
1 files changed, 56 insertions, 64 deletions
diff --git a/libstdc++-v3/include/c_std/std_cmath.h b/libstdc++-v3/include/c_std/std_cmath.h
index d6c52cfec79..b2f65c82d67 100644
--- a/libstdc++-v3/include/c_std/std_cmath.h
+++ b/libstdc++-v3/include/c_std/std_cmath.h
@@ -1,6 +1,7 @@
-// -*- C++ -*- C math library.
+// -*- C++ -*- C forwarding header.
-// Copyright (C) 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002
+// 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
@@ -43,9 +44,10 @@
#ifndef _CPP_CMATH
#define _CPP_CMATH 1
+#pragma GCC system_header
+
#include <bits/c++config.h>
-#pragma GCC system_header
#include <math.h>
// Get rid of those macros defined in <math.h> in lieu of real functions.
@@ -80,21 +82,14 @@ namespace std
// an `exported' forward declaration.
template<typename _Tp> _Tp __cmath_power(_Tp, unsigned int);
- template<typename _Tp>
- inline _Tp
- __cmath_abs(_Tp __x)
- {
- return __x < _Tp() ? -__x : __x;
- }
+ inline double
+ abs(double __x)
+ { return __builtin_fabs(__x); }
inline float
abs(float __x)
{ return __builtin_fabsf(__x); }
- inline double
- abs(double __x)
- { return __builtin_fabs(__x); }
-
inline long double
abs(long double __x)
{ return __builtin_fabsl(__x); }
@@ -117,6 +112,8 @@ namespace std
acos(long double __x) { return ::acos(static_cast<double>(__x)); }
#endif
+ using ::asin;
+
#if _GLIBCPP_HAVE_ASINF
inline float
asin(float __x) { return ::asinf(__x); }
@@ -125,8 +122,6 @@ namespace std
asin(float __x) { return ::asin(static_cast<double>(__x)); }
#endif
- using ::asin;
-
#if _GLIBCPP_HAVE_ASINL
inline long double
asin(long double __x) { return ::asinl(__x); }
@@ -135,6 +130,8 @@ namespace std
asin(long double __x) { return ::asin(static_cast<double>(__x)); }
#endif
+ using ::atan;
+
#if _GLIBCPP_HAVE_ATANF
inline float
atan(float __x) { return ::atanf(__x); }
@@ -143,8 +140,6 @@ namespace std
atan(float __x) { return ::atan(static_cast<double>(__x)); }
#endif
- using ::atan;
-
#if _GLIBCPP_HAVE_ATANL
inline long double
atan(long double __x) { return ::atanl(__x); }
@@ -153,6 +148,8 @@ namespace std
atan(long double __x) { return ::atan(static_cast<double>(__x)); }
#endif
+ using ::atan2;
+
#if _GLIBCPP_HAVE_ATAN2F
inline float
atan2(float __y, float __x) { return ::atan2f(__y, __x); }
@@ -162,8 +159,6 @@ namespace std
{ return ::atan2(static_cast<double>(__y), static_cast<double>(__x)); }
#endif
- using ::atan2;
-
#if _GLIBCPP_HAVE_ATAN2L
inline long double
atan2(long double __y, long double __x) { return ::atan2l(__y, __x); }
@@ -173,6 +168,8 @@ namespace std
{ return ::atan2(static_cast<double>(__y), static_cast<double>(__x)); }
#endif
+ using ::ceil;
+
#if _GLIBCPP_HAVE_CEILF
inline float
ceil(float __x) { return ::ceilf(__x); }
@@ -181,8 +178,6 @@ namespace std
ceil(float __x) { return ::ceil(static_cast<double>(__x)); }
#endif
- using ::ceil;
-
#if _GLIBCPP_HAVE_CEILL
inline long double
ceil(long double __x) { return ::ceill(__x); }
@@ -191,16 +186,18 @@ namespace std
ceil(long double __x) { return ::ceil(static_cast<double>(__x)); }
#endif
+ using ::cos;
+
inline float
cos(float __x)
{ return __builtin_cosf(__x); }
- using ::cos;
-
inline long double
cos(long double __x)
{ return __builtin_cosl(__x); }
+ using ::cosh;
+
#if _GLIBCPP_HAVE_COSHF
inline float
cosh(float __x) { return ::coshf(__x); }
@@ -209,8 +206,6 @@ namespace std
cosh(float __x) { return ::cosh(static_cast<double>(__x)); }
#endif
- using ::cosh;
-
#if _GLIBCPP_HAVE_COSHL
inline long double
cosh(long double __x) { return ::coshl(__x); }
@@ -219,6 +214,8 @@ namespace std
cosh(long double __x) { return ::cosh(static_cast<double>(__x)); }
#endif
+ using ::exp;
+
#if _GLIBCPP_HAVE_EXPF
inline float
exp(float __x) { return ::expf(__x); }
@@ -227,8 +224,6 @@ namespace std
exp(float __x) { return ::exp(static_cast<double>(__x)); }
#endif
- using ::exp;
-
#if _GLIBCPP_HAVE_EXPL
inline long double
exp(long double __x) { return ::expl(__x); }
@@ -237,16 +232,18 @@ namespace std
exp(long double __x) { return ::exp(static_cast<double>(__x)); }
#endif
+ using ::fabs;
+
inline float
fabs(float __x)
{ return __builtin_fabsf(__x); }
- using ::fabs;
-
inline long double
fabs(long double __x)
{ return __builtin_fabsl(__x); }
+ using ::floor;
+
#if _GLIBCPP_HAVE_FLOORF
inline float
floor(float __x) { return ::floorf(__x); }
@@ -255,8 +252,6 @@ namespace std
floor(float __x) { return ::floor(static_cast<double>(__x)); }
#endif
- using ::floor;
-
#if _GLIBCPP_HAVE_FLOORL
inline long double
floor(long double __x) { return ::floorl(__x); }
@@ -265,6 +260,8 @@ namespace std
floor(long double __x) { return ::floor(static_cast<double>(__x)); }
#endif
+ using ::fmod;
+
#if _GLIBCPP_HAVE_FMODF
inline float
fmod(float __x, float __y) { return ::fmodf(__x, __y); }
@@ -274,8 +271,6 @@ namespace std
{ return ::fmod(static_cast<double>(__x), static_cast<double>(__y)); }
#endif
- using ::fmod;
-
#if _GLIBCPP_HAVE_FMODL
inline long double
fmod(long double __x, long double __y) { return ::fmodl(__x, __y); }
@@ -285,6 +280,8 @@ namespace std
{ return ::fmod(static_cast<double>(__x), static_cast<double>(__y)); }
#endif
+ using ::frexp;
+
#if _GLIBCPP_HAVE_FREXPF
inline float
frexp(float __x, int* __exp) { return ::frexpf(__x, __exp); }
@@ -293,8 +290,6 @@ namespace std
frexp(float __x, int* __exp) { return ::frexp(__x, __exp); }
#endif
- using ::frexp;
-
#if _GLIBCPP_HAVE_FREXPL
inline long double
frexp(long double __x, int* __exp) { return ::frexpl(__x, __exp); }
@@ -304,6 +299,8 @@ namespace std
{ return ::frexp(static_cast<double>(__x), __exp); }
#endif
+ using ::ldexp;
+
#if _GLIBCPP_HAVE_LDEXPF
inline float
ldexp(float __x, int __exp) { return ::ldexpf(__x, __exp); }
@@ -313,8 +310,6 @@ namespace std
{ return ::ldexp(static_cast<double>(__x), __exp); }
#endif
- using ::ldexp;
-
#if _GLIBCPP_HAVE_LDEXPL
inline long double
ldexp(long double __x, int __exp) { return ::ldexpl(__x, __exp); }
@@ -324,6 +319,8 @@ namespace std
{ return ::ldexp(static_cast<double>(__x), __exp); }
#endif
+ using ::log;
+
#if _GLIBCPP_HAVE_LOGF
inline float
log(float __x) { return ::logf(__x); }
@@ -332,8 +329,6 @@ namespace std
{ return ::log(static_cast<double>(__x)); }
#endif
- using ::log;
-
#if _GLIBCPP_HAVE_LOGL
inline long double
log(long double __x) { return ::logl(__x); }
@@ -342,6 +337,8 @@ namespace std
log(long double __x) { return ::log(static_cast<double>(__x)); }
#endif
+ using ::log10;
+
#if _GLIBCPP_HAVE_LOG10F
inline float
log10(float __x) { return ::log10f(__x); }
@@ -350,8 +347,6 @@ namespace std
log10(float __x) { return ::log10(static_cast<double>(__x)); }
#endif
- using ::log10;
-
#if _GLIBCPP_HAVE_LOG10L
inline long double
log10(long double __x) { return ::log10l(__x); }
@@ -360,6 +355,8 @@ namespace std
log10(long double __x) { return ::log10(static_cast<double>(__x)); }
#endif
+ using ::modf;
+
#if _GLIBCPP_HAVE_MODFF
inline float
modf(float __x, float* __iptr) { return ::modff(__x, __iptr); }
@@ -374,8 +371,6 @@ namespace std
}
#endif
- using ::modf;
-
#if _GLIBCPP_HAVE_MODFL
inline long double
modf(long double __x, long double* __iptr) { return ::modfl(__x, __iptr); }
@@ -398,7 +393,9 @@ namespace std
? _Tp(1)/__cmath_power(__x, -__n)
: __cmath_power(__x, __n);
}
-
+
+ using ::pow;
+
#if _GLIBCPP_HAVE_POWF
inline float
pow(float __x, float __y) { return ::powf(__x, __y); }
@@ -408,8 +405,6 @@ namespace std
{ return ::pow(static_cast<double>(__x), static_cast<double>(__y)); }
#endif
- using ::pow;
-
#if _GLIBCPP_HAVE_POWL
inline long double
pow(long double __x, long double __y) { return ::powl(__x, __y); }
@@ -419,28 +414,30 @@ namespace std
{ return ::pow(static_cast<double>(__x), static_cast<double>(__y)); }
#endif
- inline float
- pow(float __x, int __n)
- { return __pow_helper(__x, __n); }
-
inline double
pow(double __x, int __i)
{ return __pow_helper(__x, __i); }
+ inline float
+ pow(float __x, int __n)
+ { return __pow_helper(__x, __n); }
+
inline long double
pow(long double __x, int __n)
{ return __pow_helper(__x, __n); }
+ using ::sin;
+
inline float
sin(float __x)
{ return __builtin_sinf(__x); }
- using ::sin;
-
inline long double
sin(long double __x)
{ return __builtin_sinl(__x); }
+ using ::sinh;
+
#if _GLIBCPP_HAVE_SINHF
inline float
sinh(float __x) { return ::sinhf(__x); }
@@ -449,8 +446,6 @@ namespace std
sinh(float __x) { return ::sinh(static_cast<double>(__x)); }
#endif
- using ::sinh;
-
#if _GLIBCPP_HAVE_SINHL
inline long double
sinh(long double __x) { return ::sinhl(__x); }
@@ -459,16 +454,18 @@ namespace std
sinh(long double __x) { return ::sinh(static_cast<double>(__x)); }
#endif
+ using ::sqrt;
+
inline float
sqrt(float __x)
{ return __builtin_sqrtf(__x); }
- using ::sqrt;
-
inline long double
sqrt(long double __x)
{ return __builtin_sqrtl(__x); }
+ using ::tan;
+
#if _GLIBCPP_HAVE_TANF
inline float
tan(float __x) { return ::tanf(__x); }
@@ -477,8 +474,6 @@ namespace std
tan(float __x) { return ::tan(static_cast<double>(__x)); }
#endif
- using ::tan;
-
#if _GLIBCPP_HAVE_TANL
inline long double
tan(long double __x) { return ::tanl(__x); }
@@ -487,6 +482,8 @@ namespace std
tan(long double __x) { return ::tan(static_cast<double>(__x)); }
#endif
+ using ::tanh;
+
#if _GLIBCPP_HAVE_TANHF
inline float
tanh(float __x) { return ::tanhf(__x); }
@@ -495,8 +492,6 @@ namespace std
tanh(float __x) { return ::tanh(static_cast<double>(__x)); }
#endif
- using ::tanh;
-
#if _GLIBCPP_HAVE_TANHL
inline long double
tanh(long double __x) { return ::tanhl(__x); }
@@ -656,10 +651,7 @@ namespace std
#ifdef _GLIBCPP_NO_TEMPLATE_EXPORT
# define export
-# include <cmath.tcc>
+# include <bits/cmath.tcc>
#endif
#endif
-
-
-