100db7afdSDavid E. O'Brien // -*- C++ -*- forwarding header.
200db7afdSDavid E. O'Brien 
3ffeaf689SAlexander Kabaev // Copyright (C) 2000, 2002, 2003 Free Software Foundation, Inc.
400db7afdSDavid E. O'Brien //
500db7afdSDavid E. O'Brien // This file is part of the GNU ISO C++ Library.  This library is free
600db7afdSDavid E. O'Brien // software; you can redistribute it and/or modify it under the
700db7afdSDavid E. O'Brien // terms of the GNU General Public License as published by the
800db7afdSDavid E. O'Brien // Free Software Foundation; either version 2, or (at your option)
900db7afdSDavid E. O'Brien // any later version.
1000db7afdSDavid E. O'Brien 
1100db7afdSDavid E. O'Brien // This library is distributed in the hope that it will be useful,
1200db7afdSDavid E. O'Brien // but WITHOUT ANY WARRANTY; without even the implied warranty of
1300db7afdSDavid E. O'Brien // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1400db7afdSDavid E. O'Brien // GNU General Public License for more details.
1500db7afdSDavid E. O'Brien 
1600db7afdSDavid E. O'Brien // You should have received a copy of the GNU General Public License along
1700db7afdSDavid E. O'Brien // with this library; see the file COPYING.  If not, write to the Free
18*f8a1b7d9SAlexander Kabaev // Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
1900db7afdSDavid E. O'Brien // USA.
2000db7afdSDavid E. O'Brien 
2100db7afdSDavid E. O'Brien // As a special exception, you may use this file as part of a free software
2200db7afdSDavid E. O'Brien // library without restriction.  Specifically, if other files instantiate
2300db7afdSDavid E. O'Brien // templates or use macros or inline functions from this file, or you compile
2400db7afdSDavid E. O'Brien // this file and link it with other files to produce an executable, this
2500db7afdSDavid E. O'Brien // file does not by itself cause the resulting executable to be covered by
2600db7afdSDavid E. O'Brien // the GNU General Public License.  This exception does not however
2700db7afdSDavid E. O'Brien // invalidate any other reasons why the executable file might be covered by
2800db7afdSDavid E. O'Brien // the GNU General Public License.
2900db7afdSDavid E. O'Brien 
3000db7afdSDavid E. O'Brien //
3100db7afdSDavid E. O'Brien // ISO C++ 14882: 26.5  C library
3200db7afdSDavid E. O'Brien //
3300db7afdSDavid E. O'Brien 
34ffeaf689SAlexander Kabaev #ifndef _GLIBCXX_CMATH
35ffeaf689SAlexander Kabaev #define _GLIBCXX_CMATH 1
3600db7afdSDavid E. O'Brien 
3700db7afdSDavid E. O'Brien #pragma GCC system_header
3800db7afdSDavid E. O'Brien 
39ca6500fcSAlexander Kabaev #include <bits/c++config.h>
40ca6500fcSAlexander Kabaev 
4100db7afdSDavid E. O'Brien #include_next <math.h>
4200db7afdSDavid E. O'Brien 
43ca6500fcSAlexander Kabaev // Get rid of those macros defined in <math.h> in lieu of real functions.
44ca6500fcSAlexander Kabaev #undef abs
45ca6500fcSAlexander Kabaev #undef div
46ca6500fcSAlexander Kabaev #undef acos
47ca6500fcSAlexander Kabaev #undef asin
48ca6500fcSAlexander Kabaev #undef atan
49ca6500fcSAlexander Kabaev #undef atan2
50ca6500fcSAlexander Kabaev #undef ceil
51ca6500fcSAlexander Kabaev #undef cos
52ca6500fcSAlexander Kabaev #undef cosh
53ca6500fcSAlexander Kabaev #undef exp
54ca6500fcSAlexander Kabaev #undef fabs
55ca6500fcSAlexander Kabaev #undef floor
56ca6500fcSAlexander Kabaev #undef fmod
57ca6500fcSAlexander Kabaev #undef frexp
58ca6500fcSAlexander Kabaev #undef ldexp
59ca6500fcSAlexander Kabaev #undef log
60ca6500fcSAlexander Kabaev #undef log10
61ca6500fcSAlexander Kabaev #undef modf
62ca6500fcSAlexander Kabaev #undef pow
63ca6500fcSAlexander Kabaev #undef sin
64ca6500fcSAlexander Kabaev #undef sinh
65ca6500fcSAlexander Kabaev #undef sqrt
66ca6500fcSAlexander Kabaev #undef tan
67ca6500fcSAlexander Kabaev #undef tanh
68ca6500fcSAlexander Kabaev 
69ca6500fcSAlexander Kabaev #undef fpclassify
70ca6500fcSAlexander Kabaev #undef isfinite
71ca6500fcSAlexander Kabaev #undef isinf
72ca6500fcSAlexander Kabaev #undef isnan
73ca6500fcSAlexander Kabaev #undef isnormal
74ca6500fcSAlexander Kabaev #undef signbit
75ca6500fcSAlexander Kabaev #undef isgreater
76ca6500fcSAlexander Kabaev #undef isgreaterequal
77ca6500fcSAlexander Kabaev #undef isless
78ca6500fcSAlexander Kabaev #undef islessequal
79ca6500fcSAlexander Kabaev #undef islessgreater
80ca6500fcSAlexander Kabaev #undef isunordered
81ca6500fcSAlexander Kabaev 
82ca6500fcSAlexander Kabaev namespace std
83ca6500fcSAlexander Kabaev {
84ca6500fcSAlexander Kabaev   inline double
abs(double __x)85ca6500fcSAlexander Kabaev   abs(double __x)
86ca6500fcSAlexander Kabaev   { return __builtin_fabs(__x); }
87ca6500fcSAlexander Kabaev 
88ca6500fcSAlexander Kabaev   inline float
abs(float __x)89ca6500fcSAlexander Kabaev   abs(float __x)
90ca6500fcSAlexander Kabaev   { return __builtin_fabsf(__x); }
91ca6500fcSAlexander Kabaev 
92ca6500fcSAlexander Kabaev   inline long double
abs(long double __x)93ca6500fcSAlexander Kabaev   abs(long double __x)
94ca6500fcSAlexander Kabaev   { return __builtin_fabsl(__x); }
95ca6500fcSAlexander Kabaev 
96ffeaf689SAlexander Kabaev #if _GLIBCXX_HAVE_MODFF
97ca6500fcSAlexander Kabaev   inline float
modf(float __x,float * __iptr)98ca6500fcSAlexander Kabaev   modf(float __x, float* __iptr) { return modff(__x, __iptr); }
99ca6500fcSAlexander Kabaev #else
100ca6500fcSAlexander Kabaev   inline float
modf(float __x,float * __iptr)101ca6500fcSAlexander Kabaev   modf(float __x, float* __iptr)
102ca6500fcSAlexander Kabaev   {
103ca6500fcSAlexander Kabaev     double __tmp;
104ca6500fcSAlexander Kabaev     double __res = modf(static_cast<double>(__x), &__tmp);
105ca6500fcSAlexander Kabaev     *__iptr = static_cast<float>(__tmp);
106ca6500fcSAlexander Kabaev     return __res;
107ca6500fcSAlexander Kabaev   }
108ca6500fcSAlexander Kabaev #endif
109ca6500fcSAlexander Kabaev 
110ffeaf689SAlexander Kabaev #if _GLIBCXX_HAVE_MODFL
111ca6500fcSAlexander Kabaev   inline long double
modf(long double __x,long double * __iptr)112ca6500fcSAlexander Kabaev   modf(long double __x, long double* __iptr) { return modfl(__x, __iptr); }
113ca6500fcSAlexander Kabaev #else
114ca6500fcSAlexander Kabaev   inline long double
modf(long double __x,long double * __iptr)115ca6500fcSAlexander Kabaev   modf(long double __x, long double* __iptr)
116ca6500fcSAlexander Kabaev   {
117ca6500fcSAlexander Kabaev     double __tmp;
118ca6500fcSAlexander Kabaev     double __res = modf(static_cast<double>(__x), &__tmp);
119ca6500fcSAlexander Kabaev     * __iptr = static_cast<long double>(__tmp);
120ca6500fcSAlexander Kabaev     return __res;
121ca6500fcSAlexander Kabaev   }
122ca6500fcSAlexander Kabaev #endif
123ca6500fcSAlexander Kabaev }
12400db7afdSDavid E. O'Brien #endif
125