Fix #115 by fixing the math.h and cmath includes.

This commit is contained in:
Jacob Young
2017-09-12 02:21:22 -04:00
committed by Ecco
parent e05033cf6e
commit da1e66e798
41 changed files with 497 additions and 140 deletions

View File

@@ -1,58 +1,133 @@
#ifndef LIBAXX_CMATH
#define LIBAXX_CMATH
extern "C" {
#include <math.h>
}
#undef fpclassify
#undef isfinite
#undef isnormal
#undef isnan
#undef isinf
#undef acosf
#undef acoshf
#undef asinf
#undef asinhf
#undef atanf
#undef atan2f
#undef atanhf
#undef ceilf
#undef copysignf
#undef cosf
#undef coshf
#undef expf
#undef expm1f
#undef fabsf
#undef floorf
#undef fmodf
#undef lgammaf
#undef lgammaf_r
#undef log1pf
#undef log10f
#undef logf
#undef nanf
#undef nearbyintf
#undef powf
#undef roundf
#undef scalbnf
#undef sinf
#undef sinhf
#undef sqrtf
#undef tanf
#undef tanhf
#undef acos
#undef acosh
#undef asin
#undef asinh
#undef atan
#undef atanh
#undef ceil
#undef copysign
#undef cos
#undef cosh
#undef exp
#undef expm1
#undef fabs
#undef floor
#undef lgamma
#undef lgamma_r
#undef log1p
#undef log10
#undef log
#undef pow
#undef round
#undef scalbn
#undef sin
#undef sinh
#undef sqrt
#undef tan
#undef tanh
namespace std {
static inline double acos(double x) { return ::acos(x); }
static inline float acos(float x) { return ::acosf(x); }
static inline double acosh(double x) { return ::acosh(x); }
static inline float acosh(float x) { return ::acoshf(x); }
static inline double asin(double x) { return ::asin(x); }
static inline float asin(float x) { return ::asinf(x); }
static inline double asinh(double x) { return ::asinh(x); }
static inline float asinh(float x) { return ::asinhf(x); }
static inline double atan(double x) { return ::atan(x); }
static inline float atan(float x) { return ::atanf(x); }
static inline double atanh(double x) { return ::atanh(x); }
static inline float atanh(float x) { return ::atanhf(x); }
static inline double ceil(double x) { return ::ceil(x); }
static inline float ceil(float x) { return ::ceilf(x); }
static inline double copysign(double x, double y) { return ::copysign(x, y); }
static inline float copysign(float x, float y) { return ::copysignf(x, y); }
static inline double cos(double x) { return ::cos(x); }
static inline float cos(float x) { return ::cosf(x); }
static inline double cosh(double x) { return ::cosh(x); }
static inline float cosh(float x) { return ::coshf(x); }
static inline double exp(double x) { return ::exp(x); }
static inline float exp(float x) { return ::expf(x); }
static inline double fabs(double x) { return ::fabs(x); }
static inline float fabs(float x) { return ::fabsf(x); }
static inline double floor(double x) { return ::floor(x); }
static inline float floor(float x) { return ::floorf(x); }
static inline double lgamma(double x) { return ::lgamma(x); }
static inline float lgamma(float x) { return ::lgammaf(x); }
static inline double log10(double x) { return ::log10(x); }
static inline float log10(float x) { return ::log10f(x); }
static inline double log(double x) { return ::log(x); }
static inline float log(float x) { return ::logf(x); }
static inline double pow(double x, double y) { return ::pow(x, y); }
static inline float pow(float x, float y) { return ::powf(x, y); }
static inline double round(double x) { return ::round(x); }
static inline float round(float x) { return ::roundf(x); }
static inline double sin(double x) { return ::sin(x); }
static inline float sin(float x) { return ::sinf(x); }
static inline double sinh(double x) { return ::sinh(x); }
static inline float sinh(float x) { return ::sinhf(x); }
static inline double sqrt(double x) { return ::sqrt(x); }
static inline float sqrt(float x) { return ::sqrtf(x); }
static inline double tan(double x) { return ::tan(x); }
static inline float tan(float x) { return ::tanf(x); }
static inline double tanh(double x) { return ::tanh(x); }
static inline float tanh(float x) { return ::tanhf(x); }
static inline double acos(double x) { return __builtin_acos(x); }
static inline float acos(float x) { return __builtin_acosf(x); }
static inline double acosh(double x) { return __builtin_acosh(x); }
static inline float acosh(float x) { return __builtin_acoshf(x); }
static inline double asin(double x) { return __builtin_asin(x); }
static inline float asin(float x) { return __builtin_asinf(x); }
static inline double asinh(double x) { return __builtin_asinh(x); }
static inline float asinh(float x) { return __builtin_asinhf(x); }
static inline double atan(double x) { return __builtin_atan(x); }
static inline float atan(float x) { return __builtin_atanf(x); }
static inline double atanh(double x) { return __builtin_atanh(x); }
static inline float atanh(float x) { return __builtin_atanhf(x); }
static inline double ceil(double x) { return __builtin_ceil(x); }
static inline float ceil(float x) { return __builtin_ceilf(x); }
static inline double copysign(double x, double y) { return __builtin_copysign(x, y); }
static inline float copysign(float x, float y) { return __builtin_copysignf(x, y); }
static inline double cos(double x) { return __builtin_cos(x); }
static inline float cos(float x) { return __builtin_cosf(x); }
static inline double cosh(double x) { return __builtin_cosh(x); }
static inline float cosh(float x) { return __builtin_coshf(x); }
static inline double exp(double x) { return __builtin_exp(x); }
static inline float exp(float x) { return __builtin_expf(x); }
static inline double fabs(double x) { return __builtin_fabs(x); }
static inline float fabs(float x) { return __builtin_fabsf(x); }
static inline double floor(double x) { return __builtin_floor(x); }
static inline float floor(float x) { return __builtin_floorf(x); }
static inline int fpclassify(double x) { return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL, FP_SUBNORMAL, FP_ZERO, x); }
static inline int fpclassify(float x) { return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL, FP_SUBNORMAL, FP_ZERO, x); }
static inline bool isfinite(double x) { return __builtin_isfinite(x); }
static inline bool isfinite(float x) { return __builtin_isfinite(x); }
static inline bool isinf(double x) { return __builtin_isinf(x); }
static inline bool isinf(float x) { return __builtin_isinf(x); }
static inline bool isnan(double x) { return __builtin_isnan(x); }
static inline bool isnan(float x) { return __builtin_isnan(x); }
static inline bool isnormal(double x) { return __builtin_isnormal(x); }
static inline bool isnormal(float x) { return __builtin_isnormal(x); }
static inline double lgamma(double x) { return __builtin_lgamma(x); }
static inline float lgamma(float x) { return __builtin_lgammaf(x); }
static inline double log10(double x) { return __builtin_log10(x); }
static inline float log10(float x) { return __builtin_log10f(x); }
static inline double log(double x) { return __builtin_log(x); }
static inline float log(float x) { return __builtin_logf(x); }
static inline double pow(double x, double y) { return __builtin_pow(x, y); }
static inline float pow(float x, float y) { return __builtin_powf(x, y); }
static inline double round(double x) { return __builtin_round(x); }
static inline float round(float x) { return __builtin_roundf(x); }
static inline double sin(double x) { return __builtin_sin(x); }
static inline float sin(float x) { return __builtin_sinf(x); }
static inline double sinh(double x) { return __builtin_sinh(x); }
static inline float sinh(float x) { return __builtin_sinhf(x); }
static inline double sqrt(double x) { return __builtin_sqrt(x); }
static inline float sqrt(float x) { return __builtin_sqrtf(x); }
static inline double tan(double x) { return __builtin_tan(x); }
static inline float tan(float x) { return __builtin_tanf(x); }
static inline double tanh(double x) { return __builtin_tanh(x); }
static inline float tanh(float x) { return __builtin_tanhf(x); }
}