📄 math.h
字号:
extern _ARMABI_PURE double floor(double /*d*/);
/* computes the largest integer not greater than x. */
/* Returns: the largest integer not greater than x, expressed as a double */
extern _ARMABI double fmod(double /*x*/, double /*y*/);
/* computes the floating-point remainder of x/y. */
/* Returns: the value x - i * y, for some integer i such that, if y is */
/* nonzero, the result has the same sign as x and magnitude */
/* less than the magnitude of y. If y is zero, a domain error */
/* occurs and -HUGE_VAL is returned. */
/* Additional Mathlib functions not defined by the ANSI standard.
* Not guaranteed, and not necessarily very well tested.
* C99 requires the user to include <math.h> to use these functions
* declaring them "by hand" is not sufficient
*
* The above statement is not completely true now. Some of the above
* C99 functionality has been added as per the Standard, and (where
* necessary) old Mathlib functionality withdrawn/changed. Before
* including this header #define __ENABLE_MATHLIB_LEGACY if you want to
* re-enable the legacy functionality.
*/
#if !defined(__STRICT_ANSI__) || (defined(__STDC_VERSION__) && 199901L <= __STDC_VERSION__)
extern _ARMABI double acosh(double /*x*/);
/*
* Inverse cosh. EDOM if argument < 1.0
*/
extern _ARMABI double asinh(double /*x*/);
/*
* Inverse sinh.
*/
extern _ARMABI double atanh(double /*x*/);
/*
* Inverse tanh. EDOM if |argument| > 1.0
*/
extern _ARMABI double cbrt(double /*x*/);
/*
* Cube root.
*/
extern __inline _ARMABI_SOFTFP double copysign(double __x, double __y)
/*
* Returns x with sign bit replaced by sign of y.
*/
{
__HI(__x) = (__HI(__x) & 0x7fffffff) | (__HI(__y) & 0x80000000);
return __x;
}
extern __inline _ARMABI_SOFTFP float copysignf(float __x, float __y)
/*
* Returns x with sign bit replaced by sign of y.
*/
{
__FLT(__x) = (__FLT(__x) & 0x7fffffff) | (__FLT(__y) & 0x80000000);
return __x;
}
extern _ARMABI double erf(double /*x*/);
/*
* Error function. (2/sqrt(pi)) * integral from 0 to x of exp(-t*t) dt.
*/
extern _ARMABI double erfc(double /*x*/);
/*
* 1-erf(x). (More accurate than just coding 1-erf(x), for large x.)
*/
extern _ARMABI double expm1(double /*x*/);
/*
* exp(x)-1. (More accurate than just coding exp(x)-1, for small x.)
*/
#define fpclassify(x) \
((sizeof(x) == sizeof(float)) ? \
__ARM_fpclassifyf(x) : __ARM_fpclassify(x))
/*
* Classify a floating point number into one of the following values:
*/
#define FP_ZERO (0)
#define FP_SUBNORMAL (4)
#define FP_NORMAL (5)
#define FP_INFINITE (3)
#define FP_NAN (7)
extern _ARMABI double gamma(double /*x*/);
/*
* The log of the absolute value of the gamma function of x. The sign
* of the gamma function of x is returned in the global `signgam'.
*/
extern _ARMABI double gamma_r(double /*x*/, int * /*signgam*/);
/*
* The log of the absolute value of the gamma function of x. The sign
* of the gamma function of x is returned in the second argument.
*/
extern _ARMABI double hypot(double /*x*/, double /*y*/);
/*
* sqrt(x*x+y*y), ie the length of the vector (x,y) or the
* hypotenuse of a right triangle whose other two sides are x
* and y. Won't overflow unless the _answer_ is too big, even
* if the intermediate x*x+y*y is too big.
*/
extern _ARMABI_SOFTFP int ilogb(double /*x*/);
/*
* Exponent of x (returns 0 for 1.0, 1 for 2.0, -1 for 0.5, etc.)
*/
extern _ARMABI_SOFTFP int ilogbf(float /*x*/);
/*
* Like ilogb but takes a float
*/
extern _ARMABI_SOFTFP int ilogbl(long double /*x*/);
/*
* Exponent of x (returns 0 for 1.0, 1 for 2.0, -1 for 0.5, etc.)
*/
#define FP_ILOGB0 (-0x7fffffff) /* ilogb(0) == -INT_MAX */
#define FP_ILOGBNAN ( 0x80000000) /* ilogb(NAN) == INT_MIN */
#define isfinite(x) \
((sizeof(x) == sizeof(float)) \
? __ARM_isfinitef(x) \
: __ARM_isfinite(x))
/*
* Returns true if x is a finite number, size independent.
*/
#define isgreater(x, y) \
(((sizeof(x) == sizeof(float)) && (sizeof(y) == sizeof(float))) \
? ((__ARM_fcmp4((x), (y)) & 0xf0000000) == 0x20000000) \
: ((__ARM_dcmp4((x), (y)) & 0xf0000000) == 0x20000000))
/*
* Returns true if x > y, throws no exceptions except on Signaling NaNs
*
* We want the C not set but the Z bit clear, V must be clear
*/
#define isgreaterequal(x, y) \
(((sizeof(x) == sizeof(float)) && (sizeof(y) == sizeof(float))) \
? ((__ARM_fcmp4((x), (y)) & 0x30000000) == 0x20000000) \
: ((__ARM_dcmp4((x), (y)) & 0x30000000) == 0x20000000))
/*
* Returns true if x >= y, throws no exceptions except on Signaling NaNs
*
* We just need to see if the C bit is set or not and ensure V clear
*/
#define isinf(x) \
((sizeof(x) == sizeof(float)) \
? __ARM_isinff(x) \
: __ARM_isinf(x))
/*
* Returns true if x is an infinity, size independent.
*/
#define isless(x, y) \
(((sizeof(x) == sizeof(float)) && (sizeof(y) == sizeof(float))) \
? ((__ARM_fcmp4((x), (y)) & 0xf0000000) == 0x80000000) \
: ((__ARM_dcmp4((x), (y)) & 0xf0000000) == 0x80000000))
/*
* Returns true if x < y, throws no exceptions except on Signaling NaNs
*
* We're less than if N is set, V clear
*/
#define islessequal(x, y) \
(((sizeof(x) == sizeof(float)) && (sizeof(y) == sizeof(float))) \
? ((__ARM_fcmp4((x), (y)) & 0xc0000000) != 0) \
: ((__ARM_dcmp4((x), (y)) & 0xc0000000) != 0))
/*
* Returns true if x <= y, throws no exceptions except on Signaling NaNs
*
* We're less than or equal if one of N or Z is set, V clear
*/
#define islessgreater(x, y) \
(((sizeof(x) == sizeof(float)) && (sizeof(y) == sizeof(float))) \
? __ARM_islessgreaterf((x), (y)) \
: __ARM_islessgreater((x), (y)))
/*
* Returns true if x <> y, throws no exceptions except on Signaling NaNs
* Unfortunately this test is too complicated to do in a macro without
* evaluating x & y twice. Shame really...
*/
#define isnan(x) \
((sizeof(x) == sizeof(float)) \
? __ARM_isnanf(x) \
: __ARM_isnan(x))
/*
* Returns TRUE if x is a NaN.
*/
#define isnormal(x) \
((sizeof(x) == sizeof(float)) \
? __ARM_isnormalf(x) \
: __ARM_isnormal(x))
/*
* Returns TRUE if x is a NaN.
*/
#define isunordered(x, y) \
(((sizeof(x) == sizeof(float)) && (sizeof(y) == sizeof(float))) \
? ((__ARM_fcmp4((x), (y)) & 0x10000000) == 0x10000000) \
: ((__ARM_dcmp4((x), (y)) & 0x10000000) == 0x10000000))
/*
* Returns true if x ? y, throws no exceptions except on Signaling NaNs
* Unordered occurs if and only if the V bit is set
*/
extern _ARMABI double j0(double /*x*/);
/*
* Bessel function of the first kind, order 0. Returns ERANGE
* if |x| > 2^52 (total loss of significance).
*/
extern _ARMABI double j1(double /*x*/);
/*
* Bessel function of the first kind, order 1. Returns ERANGE
* if |x| > 2^52 (total loss of significance).
*/
extern _ARMABI double jn(int /*n*/, double /*x*/);
/*
* Bessel function of the first kind, order n. Returns ERANGE
* if |x| > 2^52 (total loss of significance).
*/
extern _ARMABI double lgamma (double /*x*/);
/*
* The log of the absolute value of the gamma function of x. The sign
* of the gamma function of x is returned in the global `signgam'.
*/
extern _ARMABI double lgamma_r(double /*x*/, int * /*signgam*/);
/*
* The log of the absolute value of the gamma function of x. The sign
* of the gamma function of x is returned in the second argument.
*/
extern _ARMABI double log1p(double /*x*/);
/*
* log(1+x). (More accurate than just coding log(1+x), for small x.)
*/
extern _ARMABI_SOFTFP double logb(double /*x*/);
/*
* Like ilogb but returns a double.
*/
extern _ARMABI_SOFTFP float logbf(float /*x*/);
/*
* Like logb but takes and returns float
*/
extern _ARMABI_SOFTFP long double logbl(long double /*x*/);
/*
* Like logb but takes and returns long double
*/
extern _ARMABI_SOFTFP double nextafter(double /*x*/, double /*y*/);
/*
* Returns the next representable number after x, in the
* direction toward y.
*/
extern _ARMABI_SOFTFP float nextafterf(float /*x*/, float /*y*/);
/*
* Returns the next representable number after x, in the
* direction toward y.
*/
extern _ARMABI_SOFTFP long double nextafterl(long double /*x*/, long double /*y*/);
/*
* Returns the next representable number after x, in the
* direction toward y.
*/
extern _ARMABI_SOFTFP double nexttoward(double /*x*/, long double /*y*/);
/*
* Returns the next representable number after x, in the
* direction toward y.
*/
extern _ARMABI_SOFTFP float nexttowardf(float /*x*/, long double /*y*/);
/*
* Returns the next representable number after x, in the
* direction toward y.
*/
extern _ARMABI_SOFTFP long double nexttowardl(long double /*x*/, long double /*y*/);
/*
* Returns the next representable number after x, in the
* direction toward y.
*/
extern _ARMABI double remainder(double /*x*/, double /*y*/);
/*
* Returns the remainder of x by y, in the IEEE 754 sense.
*/
extern _ARMABI double rint(double /*x*/);
/*
* Rounds x to an integer, in the IEEE 754 sense.
*/
#ifndef __STRICT_ANSI__
extern _ARMABI double scalb(double /*x*/, double /*n*/);
/*
* Compute x times 2^n quickly. Undefined if n is not an integer.
* Not part of C99, please use scalb[l]n[f|l] instead
*/
#endif
extern _ARMABI_SOFTFP double scalbln(double /*x*/, long int /*n*/);
/*
* Compute x times 2^n quickly.
*/
extern _ARMABI_SOFTFP float scalblnf(float /*x*/, long int /*n*/);
/*
* Compute x times 2^n quickly.
*/
extern _ARMABI_SOFTFP long double scalblnl(long double /*x*/, long int /*n*/);
/*
* Compute x times 2^n quickly.
*/
extern _ARMABI_SOFTFP double scalbn(double /*x*/, int /*n*/);
/*
* Compute x times 2^n quickly.
*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -