2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
[official-gcc.git] / libstdc++-v3 / include / c / std_cmath.h
blobfcaa7594c973dddb209f13017ffca0bf7443e564
1 // -*- C++ -*- forwarding header.
3 // Copyright (C) 2000, 2002, 2003 Free Software Foundation, Inc.
4 //
5 // This file is part of the GNU ISO C++ Library. This library is free
6 // software; you can redistribute it and/or modify it under the
7 // terms of the GNU General Public License as published by the
8 // Free Software Foundation; either version 2, or (at your option)
9 // any later version.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License along
17 // with this library; see the file COPYING. If not, write to the Free
18 // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
19 // USA.
21 // As a special exception, you may use this file as part of a free software
22 // library without restriction. Specifically, if other files instantiate
23 // templates or use macros or inline functions from this file, or you compile
24 // this file and link it with other files to produce an executable, this
25 // file does not by itself cause the resulting executable to be covered by
26 // the GNU General Public License. This exception does not however
27 // invalidate any other reasons why the executable file might be covered by
28 // the GNU General Public License.
31 // ISO C++ 14882: 26.5 C library
34 #ifndef _GLIBCXX_CMATH
35 #define _GLIBCXX_CMATH 1
37 #pragma GCC system_header
39 #include <bits/c++config.h>
41 #include_next <math.h>
43 // Get rid of those macros defined in <math.h> in lieu of real functions.
44 #undef abs
45 #undef div
46 #undef acos
47 #undef asin
48 #undef atan
49 #undef atan2
50 #undef ceil
51 #undef cos
52 #undef cosh
53 #undef exp
54 #undef fabs
55 #undef floor
56 #undef fmod
57 #undef frexp
58 #undef ldexp
59 #undef log
60 #undef log10
61 #undef modf
62 #undef pow
63 #undef sin
64 #undef sinh
65 #undef sqrt
66 #undef tan
67 #undef tanh
69 #undef fpclassify
70 #undef isfinite
71 #undef isinf
72 #undef isnan
73 #undef isnormal
74 #undef signbit
75 #undef isgreater
76 #undef isgreaterequal
77 #undef isless
78 #undef islessequal
79 #undef islessgreater
80 #undef isunordered
82 namespace std
84 inline double
85 abs(double __x)
86 { return __builtin_fabs(__x); }
88 inline float
89 abs(float __x)
90 { return __builtin_fabsf(__x); }
92 inline long double
93 abs(long double __x)
94 { return __builtin_fabsl(__x); }
96 #if _GLIBCXX_HAVE_MODFF
97 inline float
98 modf(float __x, float* __iptr) { return modff(__x, __iptr); }
99 #else
100 inline float
101 modf(float __x, float* __iptr)
103 double __tmp;
104 double __res = modf(static_cast<double>(__x), &__tmp);
105 *__iptr = static_cast<float>(__tmp);
106 return __res;
108 #endif
110 #if _GLIBCXX_HAVE_MODFL
111 inline long double
112 modf(long double __x, long double* __iptr) { return modfl(__x, __iptr); }
113 #else
114 inline long double
115 modf(long double __x, long double* __iptr)
117 double __tmp;
118 double __res = modf(static_cast<double>(__x), &__tmp);
119 * __iptr = static_cast<long double>(__tmp);
120 return __res;
122 #endif
124 #endif