1*c2c66affSColin Finck//Standard C++ math declarations 2*c2c66affSColin Finck 3*c2c66affSColin Finck#pragma once 4*c2c66affSColin Finck#define _CMATH_ 5*c2c66affSColin Finck 6*c2c66affSColin Finck#include <math.h> 7*c2c66affSColin Finck 8*c2c66affSColin Finck// Get rid of those macros defined in <math.h> in lieu of real functions. 9*c2c66affSColin Finck#undef abs 10*c2c66affSColin Finck#undef div 11*c2c66affSColin Finck#undef acos 12*c2c66affSColin Finck#undef asin 13*c2c66affSColin Finck#undef atan 14*c2c66affSColin Finck#undef atan2 15*c2c66affSColin Finck#undef ceil 16*c2c66affSColin Finck#undef cos 17*c2c66affSColin Finck#undef cosh 18*c2c66affSColin Finck#undef exp 19*c2c66affSColin Finck#undef fabs 20*c2c66affSColin Finck#undef floor 21*c2c66affSColin Finck#undef fmod 22*c2c66affSColin Finck#undef frexp 23*c2c66affSColin Finck#undef ldexp 24*c2c66affSColin Finck#undef log 25*c2c66affSColin Finck#undef log10 26*c2c66affSColin Finck#undef modf 27*c2c66affSColin Finck#undef pow 28*c2c66affSColin Finck#undef sin 29*c2c66affSColin Finck#undef sinh 30*c2c66affSColin Finck#undef sqrt 31*c2c66affSColin Finck#undef tan 32*c2c66affSColin Finck#undef tanh 33*c2c66affSColin Finck 34*c2c66affSColin Finckinline double 35*c2c66affSColin Finckabs(double __x) 36*c2c66affSColin Finck{ return fabs(__x); } 37*c2c66affSColin Finck 38*c2c66affSColin Finckinline float 39*c2c66affSColin Finckabs(float __x) 40*c2c66affSColin Finck{ return fabsf(__x); } 41*c2c66affSColin Finck 42*c2c66affSColin Finckinline long double 43*c2c66affSColin Finckabs(long double __x) 44*c2c66affSColin Finck{ return fabsl(__x); } 45*c2c66affSColin Finck 46*c2c66affSColin Finckinline float 47*c2c66affSColin Finckacos(float __x) 48*c2c66affSColin Finck{ return acosf(__x); } 49*c2c66affSColin Finck 50*c2c66affSColin Finckinline long double 51*c2c66affSColin Finckacos(long double __x) 52*c2c66affSColin Finck{ return acosl(__x); } 53*c2c66affSColin Finck 54*c2c66affSColin Finckinline float 55*c2c66affSColin Finckasin(float __x) 56*c2c66affSColin Finck{ return asinf(__x); } 57*c2c66affSColin Finck 58*c2c66affSColin Finckinline long double 59*c2c66affSColin Finckasin(long double __x) 60*c2c66affSColin Finck{ return asinl(__x); } 61*c2c66affSColin Finck 62*c2c66affSColin Finckinline float 63*c2c66affSColin Finckatan(float __x) 64*c2c66affSColin Finck{ return atanf(__x); } 65*c2c66affSColin Finck 66*c2c66affSColin Finckinline long double 67*c2c66affSColin Finckatan(long double __x) 68*c2c66affSColin Finck{ return atanl(__x); } 69*c2c66affSColin Finck 70*c2c66affSColin Finckinline float 71*c2c66affSColin Finckatan2(float __y, float __x) 72*c2c66affSColin Finck{ return atan2f(__y, __x); } 73*c2c66affSColin Finck 74*c2c66affSColin Finckinline long double 75*c2c66affSColin Finckatan2(long double __y, long double __x) 76*c2c66affSColin Finck{ return atan2l(__y, __x); } 77*c2c66affSColin Finck 78*c2c66affSColin Finckinline float 79*c2c66affSColin Finckceil(float __x) 80*c2c66affSColin Finck{ return ceilf(__x); } 81*c2c66affSColin Finck 82*c2c66affSColin Finckinline long double 83*c2c66affSColin Finckceil(long double __x) 84*c2c66affSColin Finck{ return ceill(__x); } 85*c2c66affSColin Finck 86*c2c66affSColin Finckinline float 87*c2c66affSColin Finckcos(float __x) 88*c2c66affSColin Finck{ return cosf(__x); } 89*c2c66affSColin Finck 90*c2c66affSColin Finckinline long double 91*c2c66affSColin Finckcos(long double __x) 92*c2c66affSColin Finck{ return cosl(__x); } 93*c2c66affSColin Finck 94*c2c66affSColin Finckinline float 95*c2c66affSColin Finckcosh(float __x) 96*c2c66affSColin Finck{ return coshf(__x); } 97*c2c66affSColin Finck 98*c2c66affSColin Finckinline long double 99*c2c66affSColin Finckcosh(long double __x) 100*c2c66affSColin Finck{ return coshl(__x); } 101*c2c66affSColin Finck 102*c2c66affSColin Finckinline float 103*c2c66affSColin Finckexp(float __x) 104*c2c66affSColin Finck{ return expf(__x); } 105*c2c66affSColin Finck 106*c2c66affSColin Finckinline long double 107*c2c66affSColin Finckexp(long double __x) 108*c2c66affSColin Finck{ return expl(__x); } 109*c2c66affSColin Finck 110*c2c66affSColin Finckinline float 111*c2c66affSColin Finckfabs(float __x) 112*c2c66affSColin Finck{ return fabsf(__x); } 113*c2c66affSColin Finck 114*c2c66affSColin Finckinline long double 115*c2c66affSColin Finckfabs(long double __x) 116*c2c66affSColin Finck{ return fabsl(__x); } 117*c2c66affSColin Finck 118*c2c66affSColin Finckinline float 119*c2c66affSColin Finckfloor(float __x) 120*c2c66affSColin Finck{ return floorf(__x); } 121*c2c66affSColin Finck 122*c2c66affSColin Finckinline long double 123*c2c66affSColin Finckfloor(long double __x) 124*c2c66affSColin Finck{ return floorl(__x); } 125*c2c66affSColin Finck 126*c2c66affSColin Finckinline float 127*c2c66affSColin Finckfmod(float __x, float __y) 128*c2c66affSColin Finck{ return fmodf(__x, __y); } 129*c2c66affSColin Finck 130*c2c66affSColin Finckinline long double 131*c2c66affSColin Finckfmod(long double __x, long double __y) 132*c2c66affSColin Finck{ return fmodl(__x, __y); } 133*c2c66affSColin Finck 134*c2c66affSColin Finckinline float 135*c2c66affSColin Finckfrexp(float __x, int* __exp) 136*c2c66affSColin Finck{ return frexpf(__x, __exp); } 137*c2c66affSColin Finck 138*c2c66affSColin Finckinline long double 139*c2c66affSColin Finckfrexp(long double __x, int* __exp) 140*c2c66affSColin Finck{ return frexpl(__x, __exp); } 141*c2c66affSColin Finck 142*c2c66affSColin Finckinline float 143*c2c66affSColin Finckldexp(float __x, int __exp) 144*c2c66affSColin Finck{ return ldexpf(__x, __exp); } 145*c2c66affSColin Finck 146*c2c66affSColin Finckinline long double 147*c2c66affSColin Finckldexp(long double __x, int __exp) 148*c2c66affSColin Finck{ return ldexpl(__x, __exp); } 149*c2c66affSColin Finck 150*c2c66affSColin Finckinline float 151*c2c66affSColin Fincklog(float __x) 152*c2c66affSColin Finck{ return logf(__x); } 153*c2c66affSColin Finck 154*c2c66affSColin Finckinline long double 155*c2c66affSColin Fincklog(long double __x) 156*c2c66affSColin Finck{ return logl(__x); } 157*c2c66affSColin Finck 158*c2c66affSColin Finckinline float 159*c2c66affSColin Fincklog10(float __x) 160*c2c66affSColin Finck{ return log10f(__x); } 161*c2c66affSColin Finck 162*c2c66affSColin Finckinline long double 163*c2c66affSColin Fincklog10(long double __x) 164*c2c66affSColin Finck{ return log10l(__x); } 165*c2c66affSColin Finck 166*c2c66affSColin Finckinline float 167*c2c66affSColin Finckmodf(float __x, float* __iptr) 168*c2c66affSColin Finck{ return modff(__x, __iptr); } 169*c2c66affSColin Finck 170*c2c66affSColin Finckinline long double 171*c2c66affSColin Finckmodf(long double __x, long double* __iptr) 172*c2c66affSColin Finck{ return modfl(__x, __iptr); } 173*c2c66affSColin Finck 174*c2c66affSColin Finckinline float 175*c2c66affSColin Finckpow(float __x, float __y) 176*c2c66affSColin Finck{ return powf(__x, __y); } 177*c2c66affSColin Finck 178*c2c66affSColin Finckinline long double 179*c2c66affSColin Finckpow(long double __x, long double __y) 180*c2c66affSColin Finck{ return powl(__x, __y); } 181*c2c66affSColin Finck 182*c2c66affSColin Finckinline double 183*c2c66affSColin Finckpow(double __x, int __i) 184*c2c66affSColin Finck{ return pow(__x, static_cast<double>(__i)); } 185*c2c66affSColin Finck 186*c2c66affSColin Finckinline float 187*c2c66affSColin Finckpow(float __x, int __n) 188*c2c66affSColin Finck{ return powf(__x, static_cast<float>(__n)); } 189*c2c66affSColin Finck 190*c2c66affSColin Finckinline long double 191*c2c66affSColin Finckpow(long double __x, int __n) 192*c2c66affSColin Finck{ return powl(__x, static_cast<long double>(__n)); } 193*c2c66affSColin Finck 194*c2c66affSColin Finckinline float 195*c2c66affSColin Fincksin(float __x) 196*c2c66affSColin Finck{ return sinf(__x); } 197*c2c66affSColin Finck 198*c2c66affSColin Finckinline long double 199*c2c66affSColin Fincksin(long double __x) 200*c2c66affSColin Finck{ return sinl(__x); } 201*c2c66affSColin Finck 202*c2c66affSColin Finckinline float 203*c2c66affSColin Fincksinh(float __x) 204*c2c66affSColin Finck{ return sinhf(__x); } 205*c2c66affSColin Finck 206*c2c66affSColin Finckinline long double 207*c2c66affSColin Fincksinh(long double __x) 208*c2c66affSColin Finck{ return sinhl(__x); } 209*c2c66affSColin Finck 210*c2c66affSColin Finckinline float 211*c2c66affSColin Fincksqrt(float __x) 212*c2c66affSColin Finck{ return sqrtf(__x); } 213*c2c66affSColin Finck 214*c2c66affSColin Finckinline long double 215*c2c66affSColin Fincksqrt(long double __x) 216*c2c66affSColin Finck{ return sqrtl(__x); } 217*c2c66affSColin Finck 218*c2c66affSColin Finckinline float 219*c2c66affSColin Fincktan(float __x) 220*c2c66affSColin Finck{ return tanf(__x); } 221*c2c66affSColin Finck 222*c2c66affSColin Finckinline long double 223*c2c66affSColin Fincktan(long double __x) 224*c2c66affSColin Finck{ return tanl(__x); } 225*c2c66affSColin Finck 226*c2c66affSColin Finckinline float 227*c2c66affSColin Fincktanh(float __x) 228*c2c66affSColin Finck{ return tanhf(__x); } 229*c2c66affSColin Finck 230*c2c66affSColin Finckinline long double 231*c2c66affSColin Fincktanh(long double __x) 232*c2c66affSColin Finck{ return tanhl(__x); } 233*c2c66affSColin Finck 234*c2c66affSColin Fincknamespace std 235*c2c66affSColin Finck{ 236*c2c66affSColin Finck using ::abs; 237*c2c66affSColin Finck using ::acos; 238*c2c66affSColin Finck using ::asin; 239*c2c66affSColin Finck using ::atan; 240*c2c66affSColin Finck using ::atan2; 241*c2c66affSColin Finck using ::ceil; 242*c2c66affSColin Finck using ::cos; 243*c2c66affSColin Finck using ::cosh; 244*c2c66affSColin Finck using ::exp; 245*c2c66affSColin Finck using ::fabs; 246*c2c66affSColin Finck using ::floor; 247*c2c66affSColin Finck using ::fmod; 248*c2c66affSColin Finck using ::frexp; 249*c2c66affSColin Finck using ::ldexp; 250*c2c66affSColin Finck using ::log; 251*c2c66affSColin Finck using ::log10; 252*c2c66affSColin Finck using ::modf; 253*c2c66affSColin Finck using ::pow; 254*c2c66affSColin Finck using ::sin; 255*c2c66affSColin Finck using ::sinh; 256*c2c66affSColin Finck using ::sqrt; 257*c2c66affSColin Finck using ::tan; 258*c2c66affSColin Finck using ::tanh; 259*c2c66affSColin Finck} 260