organising and adding new function definitions
This commit is contained in:
parent
9a30139ada
commit
21e945d3ff
1 changed files with 80 additions and 25 deletions
105
include/math.h
105
include/math.h
|
@ -29,12 +29,41 @@ typedef double double_t;
|
||||||
#define INFINITY (1e5000)
|
#define INFINITY (1e5000)
|
||||||
#define NAN (0.0f / 0.0f)
|
#define NAN (0.0f / 0.0f)
|
||||||
|
|
||||||
|
/* iirc, this is how musl does it. */
|
||||||
|
#define HUGE_VAL INFINITY
|
||||||
|
#define HUGE_VALF ((float) INFINITY)
|
||||||
|
#define HUGE_VALL ((long double) INFINITY)
|
||||||
|
|
||||||
|
#define M_E 2.718281828
|
||||||
|
#define M_PI 3.14159265
|
||||||
|
#define PI 3.14159265
|
||||||
|
#define M_PI_2 1.5707963268
|
||||||
|
#define M_PI_4 0.7853981634
|
||||||
|
#define M_1_PI 0.318309886184
|
||||||
|
#define M_2_PI 0.636619772368
|
||||||
|
#define M_2_SQRTPI 1.1283791671
|
||||||
|
#define M_SQRT2 1.41421856237
|
||||||
|
#define M_SQRT1_2 0.707106781187
|
||||||
|
#define M_LOG2E 1.44269504089
|
||||||
|
#define M_LOG10E 0.4342944819
|
||||||
|
#define M_LN2 0.69314718056
|
||||||
|
#define M_LN10 2.302585093
|
||||||
|
|
||||||
|
#define MATH_ERRNO 1
|
||||||
|
#define MATH_ERREXCEPT 2
|
||||||
|
#define math_errhandling MATH_ERRNO
|
||||||
|
|
||||||
|
#define FP_ILOGB0 INT_MIN
|
||||||
|
#define FP_ILOGBNAN INT_MAX
|
||||||
|
|
||||||
#define FP_INFINITE 1
|
#define FP_INFINITE 1
|
||||||
#define FP_NAN 2
|
#define FP_NAN 2
|
||||||
#define FP_NORMAL 3
|
#define FP_NORMAL 3
|
||||||
#define FP_SUBNORMAL 4
|
#define FP_SUBNORMAL 4
|
||||||
#define FP_ZERO 0
|
#define FP_ZERO 0
|
||||||
|
|
||||||
|
/* Classification Macros 7.12.3 */
|
||||||
|
|
||||||
int __fpclassifyd(double x);
|
int __fpclassifyd(double x);
|
||||||
int __fpclassifyf(float x);
|
int __fpclassifyf(float x);
|
||||||
int __fpclassifyl(long double x);
|
int __fpclassifyl(long double x);
|
||||||
|
@ -63,27 +92,7 @@ int __signbitl(long double x);
|
||||||
(sizeof(x) == sizeof(double)) ? __signbitd(x) : \
|
(sizeof(x) == sizeof(double)) ? __signbitd(x) : \
|
||||||
__signbitl(x))
|
__signbitl(x))
|
||||||
|
|
||||||
#define M_E 2.718281828
|
/* Trigonometric Functions (ISO C Std. 7.12.4) */
|
||||||
#define M_PI 3.14159265
|
|
||||||
#define PI 3.14159265
|
|
||||||
#define M_PI_2 1.5707963268
|
|
||||||
#define M_PI_4 0.7853981634
|
|
||||||
#define M_1_PI 0.318309886184
|
|
||||||
#define M_2_PI 0.636619772368
|
|
||||||
#define M_2_SQRTPI 1.1283791671
|
|
||||||
#define M_SQRT2 1.41421856237
|
|
||||||
#define M_SQRT1_2 0.707106781187
|
|
||||||
#define M_LOG2E 1.44269504089
|
|
||||||
#define M_LOG10E 0.4342944819
|
|
||||||
#define M_LN2 0.69314718056
|
|
||||||
#define M_LN10 2.302585093
|
|
||||||
|
|
||||||
#define MATH_ERRNO 1
|
|
||||||
#define MATH_ERREXCEPT 2
|
|
||||||
#define math_errhandling MATH_ERRNO
|
|
||||||
|
|
||||||
#define FP_ILOGB0 INT_MIN
|
|
||||||
#define FP_ILOGBNAN INT_MAX
|
|
||||||
|
|
||||||
double acos(double);
|
double acos(double);
|
||||||
float acosf(float);
|
float acosf(float);
|
||||||
|
@ -113,6 +122,8 @@ double tan(double);
|
||||||
float tanf(float);
|
float tanf(float);
|
||||||
long double tanl(long double);
|
long double tanl(long double);
|
||||||
|
|
||||||
|
/* Hyperbolic Functions (ISO C Std. 7.12.5) */
|
||||||
|
|
||||||
double acosh(double);
|
double acosh(double);
|
||||||
float acoshf(float);
|
float acoshf(float);
|
||||||
long double acoshl(long double);
|
long double acoshl(long double);
|
||||||
|
@ -137,21 +148,65 @@ double tanh(double);
|
||||||
float tanhf(float);
|
float tanhf(float);
|
||||||
long double tanhl(long double);
|
long double tanhl(long double);
|
||||||
|
|
||||||
|
/* Exponential and Logarithmic Functions (ISO C Std. 7.12.6) */
|
||||||
|
|
||||||
double exp(double);
|
double exp(double);
|
||||||
float expf(float);
|
float expf(float);
|
||||||
long double expl(double);
|
long double expl(long double);
|
||||||
|
|
||||||
double exp2(double);
|
double exp2(double);
|
||||||
float exp2f(float);
|
float exp2f(float);
|
||||||
long double exp2l(double);
|
long double exp2l(long double);
|
||||||
|
|
||||||
double expm1(double);
|
double expm1(double);
|
||||||
float expm1f(float);
|
float expm1f(float);
|
||||||
long double expm1l(double);
|
long double expm1l(long double);
|
||||||
|
|
||||||
double frexp(double, int *);
|
double frexp(double, int *);
|
||||||
float frexpf(float, int *);
|
float frexpf(float, int *);
|
||||||
long double frexpl(double, int *);
|
long double frexpl(long double, int *);
|
||||||
|
|
||||||
|
int ilogb(double);
|
||||||
|
int ilogbf(float);
|
||||||
|
int ilogbl(long double);
|
||||||
|
|
||||||
|
double ldexp(double, int);
|
||||||
|
float ldexpf(float, int);
|
||||||
|
long double ldexpl(long double, int);
|
||||||
|
|
||||||
|
double log(double);
|
||||||
|
float logf(float);
|
||||||
|
long double logl(long double);
|
||||||
|
|
||||||
|
double log10(double);
|
||||||
|
float log10f(float);
|
||||||
|
long double log10l(long double);
|
||||||
|
|
||||||
|
double log1p(double);
|
||||||
|
float log1pf(float);
|
||||||
|
long double log1pl(long double);
|
||||||
|
|
||||||
|
double log2(double);
|
||||||
|
float log2f(float);
|
||||||
|
long double log2l(long double);
|
||||||
|
|
||||||
|
double logb(double);
|
||||||
|
float logbf(float);
|
||||||
|
long double logbl(long double);
|
||||||
|
|
||||||
|
double modf(double, double *);
|
||||||
|
float modff(float, float *);
|
||||||
|
long double modfl(long double, long double *);
|
||||||
|
|
||||||
|
double scalbn(double, int);
|
||||||
|
float scalbnf(float, int);
|
||||||
|
long double scalbnl(long double, int);
|
||||||
|
|
||||||
|
double scalbln(double, long);
|
||||||
|
float scalblnf(float, long);
|
||||||
|
long double scalblnl(long double, long);
|
||||||
|
|
||||||
|
/* Power and Absolute Value Functions (ISO C Std. 7.12.7) */
|
||||||
|
|
||||||
double fabs(double);
|
double fabs(double);
|
||||||
float fabsf(float);
|
float fabsf(float);
|
||||||
|
|
Loading…
Reference in a new issue