📄 math.h
字号:
/*
* math.h: ANSI 'C' (X3J11 Oct 88) library header, section 4.5
* Copyright (C) Codemist Ltd., 1988
* Copyright 1991-1998 ARM Limited. All rights reserved
*/
/*
* RCS $Revision: 1.34.2.1 $ Codemist 0.03
* Checkin $Date: 2001/02/22 16:23:35 $
* Revising $Author: cadeniyi $
*/
#ifndef __math_h
#define __math_h
#ifndef __MATH_DECLS
#define __MATH_DECLS
#undef __CLIBNS
#ifdef __cplusplus
#ifdef __EDG_RUNTIME_USES_NAMESPACES
namespace std {
#define __CLIBNS std::
#else
#define __CLIBNS ::
#endif /* ifdef __EDG_RUNTIME_USES_NAMESPACES */
extern "C" {
#else
#define __CLIBNS
#endif /* __cplusplus */
#ifndef HUGE_VAL
#ifndef __STRICT_ANSI__
#define HUGE_VAL (0d_7FF0000000000000)
#else
extern const double __huge_val;
#define HUGE_VAL (__huge_val)
#endif
#endif
#ifndef __STRICT_ANSI__ /* C99 extensions: */
#define INFINITY (0f_7F800000) /* positive float infinity */
#define NAN (0f_7FC00001) /* float quiet NaN */
#endif
extern double acos(double /*x*/);
/* computes the principal value of the arc cosine of x */
/* a domain error occurs for arguments not in the range -1 to 1 */
/* Returns: the arc cosine in the range 0 to Pi. */
extern double asin(double /*x*/);
/* computes the principal value of the arc sine of x */
/* a domain error occurs for arguments not in the range -1 to 1 */
/* and -HUGE_VAL is returned. */
/* Returns: the arc sine in the range -Pi/2 to Pi/2. */
extern __pure double atan(double /*x*/);
/* computes the principal value of the arc tangent of x */
/* Returns: the arc tangent in the range -Pi/2 to Pi/2. */
extern double atan2(double /*y*/, double /*x*/);
/* computes the principal value of the arc tangent of y/x, using the */
/* signs of both arguments to determine the quadrant of the return value */
/* a domain error occurs if both args are zero, and -HUGE_VAL returned. */
/* Returns: the arc tangent of y/x, in the range -Pi to Pi. */
extern __pure double cos(double /*x*/);
/* computes the cosine of x (measured in radians). A large magnitude */
/* argument may yield a result with little or no significance */
/* Returns: the cosine value. */
extern __pure double sin(double /*x*/);
/* computes the sine of x (measured in radians). A large magnitude */
/* argument may yield a result with little or no significance */
/* Returns: the sine value. */
extern void __use_accurate_range_reduction(void);
/* reference this to select the larger, slower, but more accurate */
/* range reduction in sin, cos and tan */
extern double tan(double /*x*/);
/* computes the tangent of x (measured in radians). A large magnitude */
/* argument may yield a result with little or no significance */
/* Returns: the tangent value. */
/* if range error; returns HUGE_VAL. */
extern double cosh(double /*x*/);
/* computes the hyperbolic cosine of x. A range error occurs if the */
/* magnitude of x is too large. */
/* Returns: the hyperbolic cosine value. */
/* if range error; returns HUGE_VAL. */
extern double sinh(double /*x*/);
/* computes the hyperbolic sine of x. A range error occurs if the */
/* magnitude of x is too large. */
/* Returns: the hyperbolic sine value. */
/* if range error; returns -HUGE_VAL or HUGE_VAL depending */
/* on the sign of the argument */
extern __pure double tanh(double /*x*/);
/* computes the hyperbolic tangent of x. */
/* Returns: the hyperbolic tangent value. */
extern double exp(double /*x*/);
/* computes the exponential function of x. A range error occurs if the */
/* magnitude of x is too large. */
/* Returns: the exponential value. */
/* if underflow range error; 0 is returned. */
/* if overflow range error; HUGE_VAL is returned. */
extern double frexp(double /*value*/, int * /*exp*/);
/* breaks a floating-point number into a normalised fraction and an */
/* integral power of 2. It stores the integer in the int object pointed */
/* to by exp. */
/* Returns: the value x, such that x is a double with magnitude in the */
/* interval 0.5 to 1.0 or zero, and value equals x times 2 raised to the */
/* power *exp. If value is zero, both parts of the result are zero. */
extern double ldexp(double /*x*/, int /*exp*/);
/* multiplies a floating-point number by an integral power of 2. */
/* A range error may occur. */
/* Returns: the value of x times 2 raised to the power of exp. */
/* if range error; HUGE_VAL is returned. */
extern double log(double /*x*/);
/* computes the natural logarithm of x. A domain error occurs if the */
/* argument is negative, and -HUGE_VAL is returned. A range error occurs */
/* if the argument is zero. */
/* Returns: the natural logarithm. */
/* if range error; -HUGE_VAL is returned. */
extern double log10(double /*x*/);
/* computes the base-ten logarithm of x. A domain error occurs if the */
/* argument is negative. A range error occurs if the argument is zero. */
/* Returns: the base-ten logarithm. */
extern double modf(double /*value*/, double * /*iptr*/);
/* breaks the argument value into integral and fraction parts, each of */
/* which has the same sign as the argument. It stores the integral part */
/* as a double in the object pointed to by iptr. */
/* Returns: the signed fractional part of value. */
extern double pow(double /*x*/, double /*y*/);
/* computes x raised to the power of y. A domain error occurs if x is */
/* zero and y is less than or equal to zero, or if x is negative and y */
/* is not an integer, and -HUGE_VAL returned. A range error may occur. */
/* Returns: the value of x raised to the power of y. */
/* if underflow range error; 0 is returned. */
/* if overflow range error; HUGE_VAL is returned. */
extern double sqrt(double /*x*/);
/* computes the non-negative square root of x. A domain error occurs */
/* if the argument is negative, and -HUGE_VAL returned. */
/* Returns: the value of the square root. */
#ifdef __TARGET_FPU_VFP
extern double _sqrt(double); /* native VFP double precision sqrt */
extern float _sqrtf(float); /* native VFP single precision sqrt */
#else
__inline double _sqrt(double __x) { return sqrt(__x); }
__inline float _sqrtf(float __x) { return (float)sqrt(__x); }
#endif
extern __pure double ceil(double /*x*/);
/* computes the smallest integer not less than x. */
/* Returns: the smallest integer not less than x, expressed as a double. */
extern __pure double fabs(double /*x*/);
/* computes the absolute value of the floating-point number x. */
/* Returns: the absolute value of x. */
extern float (_fabsf)(float);
#ifndef __STRICT_ANSI__
#define fabsf (_fabsf) /* C99 */
#endif
extern __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 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
*/
#ifndef __STRICT_ANSI__
#if defined __thumb || defined __TARGET_FPU_SOFTVFP || defined __TARGET_FPU_SOFTVFP_VFP || \
defined __TARGET_FPU_SOFTFPA || defined __TARGET_FPU_SOFTFPA_FPA
#define _FPMANGLE(name) __softfp_ ## name
#else
#define _FPMANGLE(name) __hardfp_ ## name
#endif
extern double _FPMANGLE(acosh) (double /*x*/);
__inline double acosh(double __x) { return _FPMANGLE(acosh)(__x); }
/*
* Inverse cosh. EDOM if argument < 1.0
*/
extern double _FPMANGLE(asinh) (double /*x*/);
__inline double asinh(double __x) { return _FPMANGLE(asinh)(__x); }
/*
* Inverse sinh.
*/
extern double _FPMANGLE(atanh) (double /*x*/);
__inline double atanh(double __x) { return _FPMANGLE(atanh)(__x); }
/*
* Inverse tanh. EDOM if |argument| > 1.0
*/
extern double _FPMANGLE(cbrt) (double /*x*/);
__inline double cbrt(double __x) { return _FPMANGLE(cbrt)(__x); }
/*
* Cube root.
*/
extern double _FPMANGLE(copysign) (double /*x*/, double /*y*/);
__inline double copysign(double __x, double __y) { return _FPMANGLE(copysign)(__x,__y); }
/*
* Returns x with sign bit replaced by sign of y.
*/
extern double _FPMANGLE(erf) (double /*x*/);
__inline double erf(double __x) { return _FPMANGLE(erf)(__x); }
/*
* Error function. (2/sqrt(pi)) * integral from 0 to x of exp(-t*t) dt.
*/
extern double _FPMANGLE(erfc) (double /*x*/);
__inline double erfc(double __x) { return _FPMANGLE(erfc)(__x); }
/*
* 1-erf(x). (More accurate than just coding 1-erf(x), for large x.)
*/
extern double _FPMANGLE(expm1) (double /*x*/);
__inline double expm1(double __x) { return _FPMANGLE(expm1)(__x); }
/*
* exp(x)-1. (More accurate than just coding exp(x)-1, for small x.)
*/
extern int _FPMANGLE(finite) (double /*x*/);
__inline double finite(double __x) { return _FPMANGLE(finite)(__x); }
/*
* TRUE if argument is finite (ie not infinity or NaN).
*/
extern double _FPMANGLE(gamma) (double /*x*/);
__inline double gamma(double __x) { return _FPMANGLE(gamma)(__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 double _FPMANGLE(gamma_r) (double /*x*/, int * /*signgam*/);
__inline double gamma_r(double __x, int *__p) { return _FPMANGLE(gamma_r)(__x,__p); }
/*
* 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 double _FPMANGLE(hypot) (double /*x*/, double /*y*/);
__inline double hypot(double __x, double __y) { return _FPMANGLE(hypot)(__x,__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 int _FPMANGLE(ilogb) (double /*x*/);
__inline int ilogb(double __x) { return _FPMANGLE(ilogb)(__x); }
/*
* Exponent of x (returns 0 for 1.0, 1 for 2.0, -1 for 0.5, etc.)
*/
extern int _FPMANGLE(isnan) (double /*x*/);
__inline double isnan(double __x) { return _FPMANGLE(isnan)(__x); }
/*
* Returns TRUE if x is a NaN.
*/
extern double _FPMANGLE(j0) (double /*x*/);
__inline double j0(double __x) { return _FPMANGLE(j0)(__x); }
/*
* Bessel function of the first kind, order 0. Returns ERANGE
* if |x| > 2^52 (total loss of significance).
*/
extern double _FPMANGLE(j1) (double /*x*/);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -