2017-10-04 18:37:32 +00:00
|
|
|
//Standard C++ math declarations
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
#define _CMATH_
|
|
|
|
|
|
|
|
#include <math.h>
|
|
|
|
|
|
|
|
// Get rid of those macros defined in <math.h> in lieu of real functions.
|
|
|
|
#undef abs
|
|
|
|
#undef div
|
|
|
|
#undef acos
|
|
|
|
#undef asin
|
|
|
|
#undef atan
|
|
|
|
#undef atan2
|
|
|
|
#undef ceil
|
|
|
|
#undef cos
|
|
|
|
#undef cosh
|
|
|
|
#undef exp
|
|
|
|
#undef fabs
|
|
|
|
#undef floor
|
|
|
|
#undef fmod
|
|
|
|
#undef frexp
|
|
|
|
#undef ldexp
|
|
|
|
#undef log
|
|
|
|
#undef log10
|
|
|
|
#undef modf
|
|
|
|
#undef pow
|
|
|
|
#undef sin
|
|
|
|
#undef sinh
|
|
|
|
#undef sqrt
|
|
|
|
#undef tan
|
|
|
|
#undef tanh
|
|
|
|
|
|
|
|
inline double
|
|
|
|
abs(double __x)
|
|
|
|
{ return fabs(__x); }
|
|
|
|
|
|
|
|
inline float
|
|
|
|
abs(float __x)
|
|
|
|
{ return fabsf(__x); }
|
|
|
|
|
|
|
|
inline long double
|
|
|
|
abs(long double __x)
|
|
|
|
{ return fabsl(__x); }
|
|
|
|
|
|
|
|
inline float
|
|
|
|
acos(float __x)
|
|
|
|
{ return acosf(__x); }
|
|
|
|
|
|
|
|
inline long double
|
|
|
|
acos(long double __x)
|
|
|
|
{ return acosl(__x); }
|
|
|
|
|
|
|
|
inline float
|
|
|
|
asin(float __x)
|
|
|
|
{ return asinf(__x); }
|
|
|
|
|
|
|
|
inline long double
|
|
|
|
asin(long double __x)
|
|
|
|
{ return asinl(__x); }
|
|
|
|
|
|
|
|
inline float
|
|
|
|
atan(float __x)
|
|
|
|
{ return atanf(__x); }
|
|
|
|
|
|
|
|
inline long double
|
|
|
|
atan(long double __x)
|
|
|
|
{ return atanl(__x); }
|
|
|
|
|
|
|
|
inline float
|
|
|
|
atan2(float __y, float __x)
|
|
|
|
{ return atan2f(__y, __x); }
|
|
|
|
|
|
|
|
inline long double
|
|
|
|
atan2(long double __y, long double __x)
|
|
|
|
{ return atan2l(__y, __x); }
|
|
|
|
|
|
|
|
inline float
|
|
|
|
ceil(float __x)
|
|
|
|
{ return ceilf(__x); }
|
|
|
|
|
|
|
|
inline long double
|
|
|
|
ceil(long double __x)
|
|
|
|
{ return ceill(__x); }
|
|
|
|
|
|
|
|
inline float
|
|
|
|
cos(float __x)
|
|
|
|
{ return cosf(__x); }
|
|
|
|
|
|
|
|
inline long double
|
|
|
|
cos(long double __x)
|
|
|
|
{ return cosl(__x); }
|
|
|
|
|
|
|
|
inline float
|
|
|
|
cosh(float __x)
|
|
|
|
{ return coshf(__x); }
|
|
|
|
|
|
|
|
inline long double
|
|
|
|
cosh(long double __x)
|
|
|
|
{ return coshl(__x); }
|
|
|
|
|
|
|
|
inline float
|
|
|
|
exp(float __x)
|
|
|
|
{ return expf(__x); }
|
|
|
|
|
|
|
|
inline long double
|
|
|
|
exp(long double __x)
|
|
|
|
{ return expl(__x); }
|
|
|
|
|
|
|
|
inline float
|
|
|
|
fabs(float __x)
|
|
|
|
{ return fabsf(__x); }
|
|
|
|
|
|
|
|
inline long double
|
|
|
|
fabs(long double __x)
|
|
|
|
{ return fabsl(__x); }
|
|
|
|
|
|
|
|
inline float
|
|
|
|
floor(float __x)
|
|
|
|
{ return floorf(__x); }
|
|
|
|
|
|
|
|
inline long double
|
|
|
|
floor(long double __x)
|
|
|
|
{ return floorl(__x); }
|
|
|
|
|
|
|
|
inline float
|
|
|
|
fmod(float __x, float __y)
|
|
|
|
{ return fmodf(__x, __y); }
|
|
|
|
|
|
|
|
inline long double
|
|
|
|
fmod(long double __x, long double __y)
|
|
|
|
{ return fmodl(__x, __y); }
|
|
|
|
|
|
|
|
inline float
|
|
|
|
frexp(float __x, int* __exp)
|
|
|
|
{ return frexpf(__x, __exp); }
|
|
|
|
|
|
|
|
inline long double
|
|
|
|
frexp(long double __x, int* __exp)
|
|
|
|
{ return frexpl(__x, __exp); }
|
|
|
|
|
|
|
|
inline float
|
|
|
|
ldexp(float __x, int __exp)
|
|
|
|
{ return ldexpf(__x, __exp); }
|
|
|
|
|
|
|
|
inline long double
|
|
|
|
ldexp(long double __x, int __exp)
|
|
|
|
{ return ldexpl(__x, __exp); }
|
|
|
|
|
|
|
|
inline float
|
|
|
|
log(float __x)
|
|
|
|
{ return logf(__x); }
|
|
|
|
|
|
|
|
inline long double
|
|
|
|
log(long double __x)
|
|
|
|
{ return logl(__x); }
|
|
|
|
|
|
|
|
inline float
|
|
|
|
log10(float __x)
|
|
|
|
{ return log10f(__x); }
|
|
|
|
|
|
|
|
inline long double
|
|
|
|
log10(long double __x)
|
|
|
|
{ return log10l(__x); }
|
|
|
|
|
|
|
|
inline float
|
|
|
|
modf(float __x, float* __iptr)
|
|
|
|
{ return modff(__x, __iptr); }
|
|
|
|
|
|
|
|
inline long double
|
|
|
|
modf(long double __x, long double* __iptr)
|
|
|
|
{ return modfl(__x, __iptr); }
|
|
|
|
|
|
|
|
inline float
|
|
|
|
pow(float __x, float __y)
|
|
|
|
{ return powf(__x, __y); }
|
|
|
|
|
|
|
|
inline long double
|
|
|
|
pow(long double __x, long double __y)
|
|
|
|
{ return powl(__x, __y); }
|
|
|
|
|
|
|
|
inline double
|
|
|
|
pow(double __x, int __i)
|
|
|
|
{ return pow(__x, static_cast<double>(__i)); }
|
|
|
|
|
|
|
|
inline float
|
|
|
|
pow(float __x, int __n)
|
|
|
|
{ return powf(__x, static_cast<float>(__n)); }
|
|
|
|
|
|
|
|
inline long double
|
|
|
|
pow(long double __x, int __n)
|
|
|
|
{ return powl(__x, static_cast<long double>(__n)); }
|
|
|
|
|
|
|
|
inline float
|
|
|
|
sin(float __x)
|
|
|
|
{ return sinf(__x); }
|
|
|
|
|
|
|
|
inline long double
|
|
|
|
sin(long double __x)
|
|
|
|
{ return sinl(__x); }
|
|
|
|
|
|
|
|
inline float
|
|
|
|
sinh(float __x)
|
|
|
|
{ return sinhf(__x); }
|
|
|
|
|
|
|
|
inline long double
|
|
|
|
sinh(long double __x)
|
|
|
|
{ return sinhl(__x); }
|
|
|
|
|
|
|
|
inline float
|
|
|
|
sqrt(float __x)
|
|
|
|
{ return sqrtf(__x); }
|
|
|
|
|
|
|
|
inline long double
|
|
|
|
sqrt(long double __x)
|
|
|
|
{ return sqrtl(__x); }
|
|
|
|
|
|
|
|
inline float
|
|
|
|
tan(float __x)
|
|
|
|
{ return tanf(__x); }
|
|
|
|
|
|
|
|
inline long double
|
|
|
|
tan(long double __x)
|
|
|
|
{ return tanl(__x); }
|
|
|
|
|
|
|
|
inline float
|
|
|
|
tanh(float __x)
|
|
|
|
{ return tanhf(__x); }
|
|
|
|
|
|
|
|
inline long double
|
|
|
|
tanh(long double __x)
|
|
|
|
{ return tanhl(__x); }
|
|
|
|
|
|
|
|
namespace std
|
|
|
|
{
|
|
|
|
using ::abs;
|
|
|
|
using ::acos;
|
|
|
|
using ::asin;
|
|
|
|
using ::atan;
|
|
|
|
using ::atan2;
|
|
|
|
using ::ceil;
|
|
|
|
using ::cos;
|
|
|
|
using ::cosh;
|
|
|
|
using ::exp;
|
|
|
|
using ::fabs;
|
|
|
|
using ::floor;
|
|
|
|
using ::fmod;
|
|
|
|
using ::frexp;
|
|
|
|
using ::ldexp;
|
|
|
|
using ::log;
|
|
|
|
using ::log10;
|
|
|
|
using ::modf;
|
|
|
|
using ::pow;
|
|
|
|
using ::sin;
|
|
|
|
using ::sinh;
|
|
|
|
using ::sqrt;
|
|
|
|
using ::tan;
|
|
|
|
using ::tanh;
|
|
|
|
}
|