1 // The -*- C++ -*- math functions header.
2 // This file is part of the GNU ANSI C++ Library.
10 #pragma interface "cmath"
18 float atan2(float, float);
25 float fmod (float, float);
26 float frexp(float, int*);
27 float modf (float, float*);
28 float ldexp(float, int);
31 float pow (float, float);
32 float pow (float, int);
40 inline float abs (float x) { return fabs (x); }
41 #if ! _G_MATH_H_INLINES /* hpux and SCO define this in math.h */
42 inline double abs (double x) { return fabs (x); }
46 double pow(double, int);
48 long double acos (long double);
49 long double asin (long double);
50 long double atan (long double);
51 long double atan2(long double, long double);
52 long double ceil (long double);
53 long double cos (long double);
54 long double cosh (long double);
55 long double exp (long double);
56 long double fabs (long double);
57 long double floor(long double);
58 long double frexp(long double, int*);
59 long double fmod (long double, long double);
60 long double frexp(long double, int*);
61 long double log (long double);
62 long double log10(long double);
63 long double modf (long double, long double*);
64 long double pow (long double, long double);
65 long double pow (long double, int);
66 long double sin (long double);
67 long double sinh (long double);
68 long double sqrt (long double);
69 long double tan (long double);
70 long double tanh (long double);
72 inline long double abs (long double x) { return fabs (x); }
76 // These are possible macros imported from C99-land.
92 inline int fpclassify(float __x) { return __fpclassifyf(__x); }
93 inline int fpclassify(double __x) { return __fpclassify(__x); }
94 inline int fpclassify(long double __x) { return __fpclassifyl(__x); }
96 inline bool isfinite(float __x) { return __finitef(__x); }
97 inline bool isfinite(double __x) { return __finite(__x); }
98 inline bool isfinite(long double __x) { return __finitel(__x); }
100 inline bool isinf(float __x) { return __isinff(__x); }
101 inline bool isinf(double __x) { return __isinf(__x); }
102 inline bool isinf(long double __x) { return __isinfl(__x); }
104 inline bool isnan(float __x) { return __isnanf(__x); }
105 inline bool isnan(double __x) { return __isnan(__x); }
106 inline bool isnan(long double __x) { return __isnanl(__x); }
108 inline bool isnormal(float __x) { return __fpclassifyf(__x) == FP_NORMAL; }
109 inline bool isnormal(double __x) { return __fpclassify(__x) == FP_NORMAL; }
110 inline bool isnormal(long double __x) { return __fpclassifyl(__x) == FP_NORMAL; }
112 inline bool signbit(float __x) { return __signbitf(__x); }
113 inline bool signbit(double __x) { return __signbit(__x); }
114 inline bool signbit(long double __x) { return __signbitl(__x); }
116 #undef _wrap_expr_typeof
117 #define _wrap_expr_typeof(x, y, body) ({ \
118 __typeof(x) X = (x); \
119 __typeof(y) Y = (y); \
122 inline bool isgreater(float __x, float __y) {
123 _wrap_expr_typeof(__x, __y, !isnan(X) && !isnan(Y) && X > Y);
125 inline bool isgreater(double __x, double __y) {
126 _wrap_expr_typeof(__x, __y, !isnan(X) && !isnan(Y) && X > Y);
128 inline bool isgreater(long double __x, long double __y) {
129 _wrap_expr_typeof(__x, __y, !isnan(X) && !isnan(Y) && X > Y);
132 inline bool isgreaterequal(float __x, float __y) {
133 _wrap_expr_typeof(__x, __y, !isnan(X) && !isnan(Y) && X >= Y);
135 inline bool isgreaterequal(double __x, double __y) {
136 _wrap_expr_typeof(__x, __y, !isnan(X) && !isnan(Y) && X >= Y);
138 inline bool isgreaterequal(long double __x, long double __y) {
139 _wrap_expr_typeof(__x, __y, !isnan(X) && !isnan(Y) && X >= Y);
142 inline bool isless(float __x, float __y) {
143 _wrap_expr_typeof(__x, __y, !isnan(X) && !isnan(Y) && X < Y);
145 inline bool isless(double __x, double __y) {
146 _wrap_expr_typeof(__x, __y, !isnan(X) && !isnan(Y) && X < Y);
148 inline bool isless(long double __x, long double __y) {
149 _wrap_expr_typeof(__x, __y, !isnan(X) && !isnan(Y) && X < Y);
152 inline bool islessequal(float __x, float __y) {
153 _wrap_expr_typeof(__x, __y, !isnan(X) && !isnan(Y) && X <= Y);
155 inline bool islessequal(double __x, double __y) {
156 _wrap_expr_typeof(__x, __y, !isnan(X) && !isnan(Y) && X <= Y);
158 inline bool islessequal(long double __x, long double __y) {
159 _wrap_expr_typeof(__x, __y, !isnan(X) && !isnan(Y) && X <= Y);
162 inline bool islessgeater(float __x, float __y) {
163 _wrap_expr_typeof(__x, __y, X < Y || Y < X);
165 inline bool islessgreater(double __x, double __y) {
166 _wrap_expr_typeof(__x, __y, X < Y || Y < X);
168 inline bool islessgreater(long double __x, long double __y) {
169 _wrap_expr_typeof(__x, __y, X < Y || Y < X);
172 inline bool isunordered(float __x, float __y) {
173 _wrap_expr_typeof(__x, __y, isnan(X) || isnan(Y));
175 inline bool isunordered(double __x, double __y) {
176 _wrap_expr_typeof(__x, __y, isnan(X) || isnan(Y));
178 inline bool isunordered(long double __x, long double __y) {
179 _wrap_expr_typeof(__x, __y, isnan(X) || isnan(Y));
182 #undef _wrap_expr_typeof