#ifndef MSL_CPP_CMATH_H
#define MSL_CPP_CMATH_H
#include <math.h>
#ifdef __cplusplus

// Remove C macro
#undef fabs

namespace std {
using ::acos;
// using ::acosf;
using ::asin;
// using ::asinf;
using ::atan;
using ::atan2;
using ::atan2f;
using ::ceil;
// using ::ceilf;
using ::copysign;
using ::cos;
// using ::cosf;
// using ::fabsf;
using ::floor;
// using ::floorf;
using ::fmod;
using ::fmodf;
using ::frexp;
using ::ldexp;
// using ::ldexpf;
using ::modf;
using ::modff;
// using ::nan;
using ::pow;
using ::scalbn;
using ::sin;
// using ::sinf;
using ::sqrt;
// using ::sqrtf;
using ::tan;
using ::tanf;

inline float ceilf(float x) {
    return ::ceil(x);
}

inline float floorf(float x) {
    return ::floor(x);
}

inline float cosf(float x) {
    return cos(x);
}

inline float sinf(float x) {
    return sin(x);
}

inline float sqrtf(float x) {
    return ::sqrtf(x);
}

inline float acosf(float x) {
    return ::acos(x);
}

// TODO: Very fake!
// inline double fabs_wrapper(double x) {
//     return __fabs(x);
// }

// inline float fabs(float x) {
//     return fabs_wrapper(x);
// }

} // namespace std

#define _HUGE_ENUF 1e+300
#define INFINITY ((float)(_HUGE_ENUF * _HUGE_ENUF))
#define HUGE_VAL ((double)INFINITY)
#define HUGE_VALL ((long double)INFINITY)

#define DOUBLE_INF HUGE_VAL

#endif
#endif
