58 #ifndef __INCLUDE_MATH_H 61 #define __INCLUDE_MATH_H 67 #include <tinyara/config.h> 75 #ifdef CONFIG_ARCH_MATH_H 76 #include <arch/math.h> 84 #elif defined(CONFIG_LIBM) 107 #include <tinyara/config.h> 108 #include <tinyara/compiler.h> 116 #define INFINITY (1.0/0.0) 117 #define NAN (0.0/0.0) 118 #define HUGE_VAL INFINITY 120 #define isnan(x) ((x) != (x)) 121 #define isinf(x) (((x) == INFINITY) || ((x) == -INFINITY)) 122 #define isfinite(x) (!(isinf(x)) && (x != NAN)) 124 static __inline
unsigned __FLOAT_BITS(
float __f)
134 #if CONFIG_HAVE_DOUBLE 135 static __inline
unsigned long long __DOUBLE_BITS(
double __f)
139 unsigned long long __i;
146 #define signbit(x) ( \ 147 sizeof(x) == sizeof(float) ? (int)(__FLOAT_BITS(x) >> 31) : \ 148 sizeof(x) == sizeof(double) ? (int)(__DOUBLE_BITS(x) >> 63) : \ 149 (int)(__DOUBLE_BITS(x) >> 63)) 153 #define M_E 2.7182818284590452353602874713526625 154 #define M_SQRT2 1.4142135623730950488016887242096981 155 #define M_SQRT1_2 0.7071067811865475244008443621048490 156 #define M_LOG2E 1.4426950408889634073599246810018921 157 #define M_LOG10E 0.4342944819032518276511289189166051 158 #define M_LN2 0.6931471805599453094172321214581765 159 #define M_LN10 2.3025850929940456840179914546843642 163 #define M_PI 3.1415926535897932384626433832795029 164 #define M_PI_2 1.5707963267948966192313216916397514 165 #define M_PI_4 0.7853981633974483096156608458198757 166 #define M_1_PI 0.3183098861837906715377675267450287 167 #define M_2_PI 0.6366197723675813430755350534900574 168 #define M_2_SQRTPI 1.1283791670955125738961589031215452 174 #if defined(__cplusplus) 186 float ceilf(
float x);
187 #ifdef CONFIG_HAVE_DOUBLE 195 double ceil(
double x);
197 #ifdef CONFIG_HAVE_LONG_DOUBLE 205 long double ceill(
long double x);
215 #ifdef CONFIG_HAVE_DOUBLE 223 double floor(
double x);
225 #ifdef CONFIG_HAVE_LONG_DOUBLE 233 long double floorl(
long double x);
243 #ifdef CONFIG_HAVE_DOUBLE 251 double round(
double x);
253 #ifdef CONFIG_HAVE_LONG_DOUBLE 261 long double roundl(
long double x);
270 float rintf(
float x);
271 #ifdef CONFIG_HAVE_DOUBLE 279 double rint(
double x);
281 #ifdef CONFIG_HAVE_LONG_DOUBLE 289 long double rintl(
long double x);
298 float fabsf(
float x);
299 #ifdef CONFIG_HAVE_DOUBLE 307 double fabs(
double x);
309 #ifdef CONFIG_HAVE_LONG_DOUBLE 317 long double fabsl(
long double x);
323 float modff(
float x,
float *iptr);
324 #ifdef CONFIG_HAVE_DOUBLE 328 double modf(
double x,
double *iptr);
333 #ifdef CONFIG_HAVE_LONG_DOUBLE 334 long double modfl(
long double x,
long double *iptr);
339 float fmodf(
float x,
float div);
340 #ifdef CONFIG_HAVE_DOUBLE 344 double fmod(
double x,
double div);
346 #ifdef CONFIG_HAVE_LONG_DOUBLE 350 long double fmodl(
long double x,
long double div);
356 float powf(
float b,
float e);
360 #ifdef CONFIG_HAVE_DOUBLE 368 double pow(
double b,
double e);
370 #ifdef CONFIG_HAVE_LONG_DOUBLE 375 long double powl(
long double b,
long double e);
395 #define expm1f(x) (expf(x) - 1.0) 396 #ifdef CONFIG_HAVE_DOUBLE 404 double exp(
double x);
405 #define expm1(x) (exp(x) - 1.0) 407 #ifdef CONFIG_HAVE_LONG_DOUBLE 415 long double expl(
long double x);
416 #define expm1l(x) (expl(x) - 1.0) 425 float exp2f(
float x);
426 #ifdef CONFIG_HAVE_DOUBLE 434 double exp2(
double x);
436 #ifdef CONFIG_HAVE_LONG_DOUBLE 444 long double exp2l(
long double x);
446 #ifdef CONFIG_HAVE_DOUBLE 451 double __cos(
double x,
double y);
455 double __sin(
double x,
double y,
int iy);
459 double gamma(
double x);
463 double lgamma(
double x);
473 #ifdef CONFIG_HAVE_DOUBLE 477 double log(
double x);
479 #ifdef CONFIG_HAVE_LONG_DOUBLE 483 long double logl(
long double x);
488 float log10f(
float x);
489 #if CONFIG_HAVE_DOUBLE 493 double log10(
double x);
495 #ifdef CONFIG_HAVE_LONG_DOUBLE 499 long double log10l(
long double x);
511 float log2f(
float x);
512 #ifdef CONFIG_HAVE_DOUBLE 520 double log2(
double x);
522 #ifdef CONFIG_HAVE_LONG_DOUBLE 530 long double log2l(
long double x);
539 float cbrtf(
float x);
540 #ifdef CONFIG_HAVE_DOUBLE 548 double cbrt(
double x);
550 #ifdef CONFIG_HAVE_LONG_DOUBLE 558 long double cbrtl(
long double x);
567 float sqrtf(
float x);
568 #ifdef CONFIG_HAVE_DOUBLE 576 double sqrt(
double x);
578 #ifdef CONFIG_HAVE_LONG_DOUBLE 586 long double sqrtl(
long double x);
595 float ldexpf(
float x,
int n);
596 #ifdef CONFIG_HAVE_DOUBLE 604 double ldexp(
double x,
int n);
606 #ifdef CONFIG_HAVE_LONG_DOUBLE 614 long double ldexpl(
long double x,
int n);
624 #ifdef CONFIG_HAVE_DOUBLE 634 #ifdef CONFIG_HAVE_LONG_DOUBLE 642 long double frexpl(
long double x,
int *
exp);
654 #ifdef CONFIG_HAVE_DOUBLE 662 double sin(
double x);
664 #ifdef CONFIG_HAVE_LONG_DOUBLE 672 long double sinl(
long double x);
682 #ifdef CONFIG_HAVE_DOUBLE 690 double cos(
double x);
692 #ifdef CONFIG_HAVE_LONG_DOUBLE 700 long double cosl(
long double x);
710 #if CONFIG_HAVE_DOUBLE 718 double tan(
double x);
720 #ifdef CONFIG_HAVE_LONG_DOUBLE 728 long double tanl(
long double x);
737 float asinf(
float x);
738 #ifdef CONFIG_HAVE_DOUBLE 746 double asin(
double x);
748 #ifdef CONFIG_HAVE_LONG_DOUBLE 756 long double asinl(
long double x);
765 float acosf(
float x);
766 #if CONFIG_HAVE_DOUBLE 774 double acos(
double x);
776 #ifdef CONFIG_HAVE_LONG_DOUBLE 784 long double acosl(
long double x);
793 float atanf(
float x);
794 #ifdef CONFIG_HAVE_DOUBLE 802 double atan(
double x);
804 #ifdef CONFIG_HAVE_LONG_DOUBLE 812 long double atanl(
long double x);
821 float atan2f(
float y,
float x);
822 #ifdef CONFIG_HAVE_DOUBLE 830 double atan2(
double y,
double x);
832 #ifdef CONFIG_HAVE_LONG_DOUBLE 840 long double atan2l(
long double y,
long double x);
849 float sinhf(
float x);
850 #ifdef CONFIG_HAVE_DOUBLE 858 double sinh(
double x);
860 #ifdef CONFIG_HAVE_LONG_DOUBLE 868 long double sinhl(
long double x);
877 float coshf(
float x);
878 #ifdef CONFIG_HAVE_DOUBLE 886 double cosh(
double x);
888 #ifdef CONFIG_HAVE_LONG_DOUBLE 896 long double coshl(
long double x);
905 float tanhf(
float x);
906 #ifdef CONFIG_HAVE_DOUBLE 914 double tanh(
double x);
916 #ifdef CONFIG_HAVE_LONG_DOUBLE 924 long double tanhl(
long double x);
934 #ifdef CONFIG_HAVE_DOUBLE 942 double asinh(
double x);
944 #ifdef CONFIG_HAVE_LONG_DOUBLE 952 long double asinhl(
long double x);
962 #ifdef CONFIG_HAVE_DOUBLE 970 double acosh(
double x);
972 #ifdef CONFIG_HAVE_LONG_DOUBLE 980 long double acoshl(
long double x);
990 #ifdef CONFIG_HAVE_DOUBLE 998 double atanh(
double x);
1000 #ifdef CONFIG_HAVE_LONG_DOUBLE 1008 long double atanhl(
long double x);
1017 float erff(
float x);
1022 #define erfcf(x) (1 - erff(x)) 1023 #ifdef CONFIG_HAVE_DOUBLE 1034 double erf(
double x);
1035 #define erfc(x) (1 - erf(x)) 1037 #ifdef CONFIG_HAVE_LONG_DOUBLE 1045 long double erfl(
long double x);
1046 #define erfcl(x) (1 - erfl(x)) 1056 #ifdef CONFIG_HAVE_DOUBLE 1064 double copysign(
double x,
double y);
1066 #ifdef CONFIG_HAVE_LONG_DOUBLE 1074 long double copysignl(
long double x,
long double y);
1084 #ifdef CONFIG_HAVE_DOUBLE 1092 double trunc(
double x);
1094 #ifdef CONFIG_HAVE_LONG_DOUBLE 1102 long double truncl(
long double x);
1111 float fdimf(
float x,
float y);
1112 #ifdef CONFIG_HAVE_DOUBLE 1120 double fdim(
double x,
double y);
1122 #ifdef CONFIG_HAVE_LONG_DOUBLE 1130 long double fdiml(
long double x,
long double y);
1139 float fmaxf(
float x,
float y);
1140 #ifdef CONFIG_HAVE_DOUBLE 1148 double fmax(
double x,
double y);
1150 #ifdef CONFIG_HAVE_LONG_DOUBLE 1158 long double fmaxl(
long double x,
long double y);
1167 float fminf(
float x,
float y);
1168 #ifdef CONFIG_HAVE_DOUBLE 1176 double fmin(
double x,
double y);
1178 #ifdef CONFIG_HAVE_LONG_DOUBLE 1186 long double fminl(
long double x,
long double y);
1195 float hypotf(
float x,
float y);
1196 #ifdef CONFIG_HAVE_DOUBLE 1204 double hypot(
double x,
double y);
1206 #ifdef CONFIG_HAVE_LONG_DOUBLE 1214 long double hypotl(
long double x,
long double y);
1224 #ifdef CONFIG_HAVE_DOUBLE 1234 #ifdef CONFIG_HAVE_LONG_DOUBLE 1274 float jnf(
int n,
float x);
1275 #ifdef CONFIG_HAVE_DOUBLE 1283 double j0(
double x);
1291 double j1(
double x);
1299 double jn(
int n,
double x);
1334 float ynf(
int n,
float x);
1335 #ifdef CONFIG_HAVE_DOUBLE 1343 double y0(
double x);
1351 double y1(
double x);
1359 double yn(
int n,
double x);
1361 #ifdef CONFIG_HAVE_DOUBLE 1379 #ifdef CONFIG_HAVE_LONG_DOUBLE 1387 long double nextafterl(
long double x,
long double y);
1389 #ifdef CONFIG_HAVE_DOUBLE 1407 #ifdef CONFIG_HAVE_LONG_DOUBLE 1415 long double nexttowardl(
long double x,
long double y);
1417 #ifdef CONFIG_HAVE_DOUBLE 1435 #ifdef CONFIG_HAVE_LONG_DOUBLE 1443 long double remainderl(
long double x,
long double y);
1445 #ifdef CONFIG_HAVE_DOUBLE 1453 double remquo(
double x,
double y,
int *quo);
1462 float remquof(
float x,
float y,
int *quo);
1463 #ifdef CONFIG_HAVE_LONG_DOUBLE 1471 long double remquol(
long double x,
long double y,
int *quo);
1477 #define nanf(x) ((float)(NAN)) 1481 #ifdef CONFIG_HAVE_DOUBLE 1482 #define nan(x) ((double)(NAN)) 1484 #ifdef CONFIG_HAVE_LONG_DOUBLE 1485 #define nanl(x) ((long double)(NAN)) 1491 #if defined(__cplusplus) long double atanhl(long double x)
inverse hyperbolic tangent functions
double atan2(double y, double x)
arc tangent function
double j0(double x)
Bessel functions of the first kind.
float coshf(float x)
hyperbolic cosine functions
long double asinl(long double x)
arc sine function
float sinhf(float x)
hyperbolic sine functions
double acosh(double x)
inverse hyperbolic cosine functions
long double ldexpl(long double x, int n)
load exponent of a floating-point number
float log2f(float x)
compute base 2 logarithm functions
long double floorl(long double x)
floor function
float frexpf(float x, int *exp)
extract mantissa and exponent from a double precision number
double fabs(double x)
absolute value function
float y0f(float x)
returns Bessel functions of x of the second kind of orders 0
long double rintl(long double x)
round-to-nearest integral value
double rint(double x)
round-to-nearest integral value
float copysignf(float x, float y)
number manipulation function
long double cosl(long double x)
cosine function
long double atanl(long double x)
arc tangent function
double nexttoward(double x, long double y)
next representable floating-point number
long double truncl(long double x)
round to truncated integer value
long double acoshl(long double x)
inverse hyperbolic cosine functions
float nexttowardf(float x, long double y)
next representable floating-point number
float erff(float x)
error functions
double exp2(double x)
exponential base 2 functions
double fmin(double x, double y)
determine minimum numeric value of two floating-point numbers
float rintf(float x)
round-to-nearest integral value
long double sqrtl(long double x)
square root function
long double hypotl(long double x, long double y)
Euclidean distance function.
double nextafter(double x, double y)
next representable floating-point number
float asinhf(float x)
inverse hyperbolic sine functions
long double log2l(long double x)
compute base 2 logarithm functions
double cbrt(double x)
cube root functions
float expf(float x)
exponential function
long double expl(long double x)
exponential function
float j1f(float x)
returns Bessel functions of x of the first kind of orders 1
double erf(double x)
error functions
float sinf(float x)
sine function
double pow(double b, double e)
power function
double y1(double x)
Bessel functions of the second kind.
long double copysignl(long double x, long double y)
number manipulation function
long double sinhl(long double x)
hyperbolic sine functions
float atanf(float x)
arc cosine functions
long double cbrtl(long double x)
cube root functions
long double coshl(long double x)
hyperbolic cosine functions
long double fminl(long double x, long double y)
determine minimum numeric value of two floating-point numbers
long double acosl(long double x)
arc cosine functions
long double exp2l(long double x)
exponential base 2 functions
double hypot(double x, double y)
Euclidean distance function.
long double fdiml(long double x, long double y)
compute positive difference between two floating-point numbers
double exp(double x)
exponential function
float tanhf(float x)
hyperbolic tangent functions
float remainderf(float x, float y)
remainder function
long double nextafterl(long double x, long double y)
next representable floating-point number
double sin(double x)
sine function
double y0(double x)
Bessel functions of the second kind.
float atanhf(float x)
inverse hyperbolic tangent functions
float jnf(int n, float x)
returns Bessel functions of x of the first kind of orders n
float sqrtf(float x)
square root function
float ldexpf(float x, int n)
load exponent of a floating-point number
long double nexttowardl(long double x, long double y)
next representable floating-point number
double remainder(double x, double y)
remainder function
float ynf(int n, float x)
returns Bessel functions of x of the second kind of orders n
float tanf(float x)
tangent function
long double erfl(long double x)
error functions
double copysign(double x, double y)
number manipulation function
double atan(double x)
arc tangent function
double j1(double x)
Bessel functions of the first kind.
double frexp(double x, int *exp)
extract mantissa and exponent from a double precision number
double floor(double x)
floor function
float exp2f(float x)
exponential base 2 functions
long double remquol(long double x, long double y, int *quo)
remainder functions
double acos(double x)
arc cosine functions
float roundf(float x)
round to the nearest integer value in a floating-point format
double scalbn(double x, int exp)
compute exponent using FLT_RADIX
float cbrtf(float x)
cube root functions
long double frexpl(long double x, int *exp)
extract mantissa and exponent from a double precision number
double cos(double x)
cosine function
float scalbnf(float x, int exp)
compute exponent using FLT_RADIX
float y1f(float x)
returns Bessel functions of x of the second kind of orders 1
long double remainderl(long double x, long double y)
remainder function
double tanh(double x)
hyperbolic tangent functions
double round(double x)
round to the nearest integer value in a floating-point format
double remquo(double x, double y, int *quo)
remainder functions
float asinf(float x)
arc sine function
float fminf(float x, float y)
determine minimum numeric value of two floating-point numbers
long double atan2l(long double y, long double x)
arc tangent function
double atanh(double x)
inverse hyperbolic tangent functions
double asinh(double x)
inverse hyperbolic sine functions
double sqrt(double x)
square root function
double tan(double x)
tangent function
double yn(int n, double x)
Bessel functions of the second kind.
float fdimf(float x, float y)
compute positive difference between two floating-point numbers
float atan2f(float y, float x)
arc tangent function
float acoshf(float x)
inverse hyperbolic cosine functions
long double tanhl(long double x)
hyperbolic tangent functions
double trunc(double x)
round to truncated integer value
double ceil(double x)
ceiling value function
long double sinl(long double x)
sine function
double jn(int n, double x)
Bessel functions of the first kind.
long double fmaxl(long double x, long double y)
determine maximum numeric value of two floating-point numbers
long double fabsl(long double x)
absolute value function
float truncf(float x)
round to truncated integer value
double log2(double x)
compute base 2 logarithm functions
double sinh(double x)
hyperbolic sine functions
long double scalbnl(long double x, int exp)
compute exponent using FLT_RADIX
float nextafterf(float x, float y)
next representable floating-point number
double asin(double x)
arc sine function
div_t div(int numer, int denom)
compute the quotient and remainder of an integer division
float fabsf(float x)
absolute value function
float fmaxf(float x, float y)
double ldexp(double x, int n)
load exponent of a floating-point number
double fmax(double x, double y)
determine maximum numeric value of two floating-point numbers
double cosh(double x)
hyperbolic cosine functions
long double roundl(long double x)
round to the nearest integer value in a floating-point format
float cosf(float x)
cosine function
float hypotf(float x, float y)
Euclidean distance function.
long double tanl(long double x)
tangent function
long double ceill(long double x)
ceiling value function
float floorf(float x)
floor function
float ceilf(float x)
ceiling value function
long double asinhl(long double x)
inverse hyperbolic sine functions
float remquof(float x, float y, int *quo)
remainder functions
double fdim(double x, double y)
compute positive difference between two floating-point numbers
float j0f(float x)
returns Bessel functions of x of the first kind of orders 0