📄 math.h
字号:
/***
*math.h - definitions and declarations for math library
*
* Copyright (c) Microsoft Corporation. All rights reserved.
*
*Purpose:
* This file contains constant definitions and external subroutine
* declarations for the math subroutine library.
* [ANSI/System V]
*
* [Public]
*
****/
#ifndef _INC_MATH
#define _INC_MATH
#include <crtdefs.h>
/*
* Currently, all MS C compilers for Win32 platforms default to 8 byte
* alignment.
*/
#pragma pack(push,_CRT_PACKING)
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#ifndef __assembler
/* Definition of _exception struct - this struct is passed to the matherr
* routine when a floating point exception is detected
*/
#ifndef _EXCEPTION_DEFINED
struct _exception {
int type; /* exception type - see below */
char *name; /* name of function where error occured */
double arg1; /* first argument to function */
double arg2; /* second argument (if any) to function */
double retval; /* value to be returned by function */
} ;
#define _EXCEPTION_DEFINED
#endif /* _EXCEPTION_DEFINED */
/* Definition of a _complex struct to be used by those who use cabs and
* want type checking on their argument
*/
#ifndef _COMPLEX_DEFINED
struct _complex {
double x,y; /* real and imaginary parts */
} ;
#if !__STDC__ && !defined (__cplusplus)
/* Non-ANSI name for compatibility */
#define complex _complex
#endif /* !__STDC__ && !defined (__cplusplus) */
#define _COMPLEX_DEFINED
#endif /* _COMPLEX_DEFINED */
#endif /* __assembler */
/* Constant definitions for the exception type passed in the _exception struct
*/
#define _DOMAIN 1 /* argument domain error */
#define _SING 2 /* argument singularity */
#define _OVERFLOW 3 /* overflow range error */
#define _UNDERFLOW 4 /* underflow range error */
#define _TLOSS 5 /* total loss of precision */
#define _PLOSS 6 /* partial loss of precision */
#define EDOM 33
#define ERANGE 34
/* Definitions of _HUGE and HUGE_VAL - respectively the XENIX and ANSI names
* for a value returned in case of error by a number of the floating point
* math routines
*/
#ifndef __assembler
#if !defined (_M_CEE_PURE)
_CRTIMP extern double _HUGE;
#else /* !defined (_M_CEE_PURE) */
const double _HUGE = System::Double::PositiveInfinity;
#endif /* !defined (_M_CEE_PURE) */
#endif /* __assembler */
#define HUGE_VAL _HUGE
/* Function prototypes */
#if !defined (__assembler)
#ifndef _CRT_ABS_DEFINED
#define _CRT_ABS_DEFINED
int __cdecl abs(_In_ int _X);
long __cdecl labs(_In_ long _X);
long long __cdecl llabs(_In_ long long _X);
#endif /* _CRT_ABS_DEFINED */
double __cdecl acos(_In_ double _X);
double __cdecl asin(_In_ double _X);
double __cdecl atan(_In_ double _X);
double __cdecl atan2(_In_ double _Y, _In_ double _X);
#ifndef _SIGN_DEFINED
_Check_return_ _CRTIMP double __cdecl _copysign (_In_ double _Number, _In_ double _Sign);
_Check_return_ _CRTIMP double __cdecl _chgsign (_In_ double _X);
#define _SIGN_DEFINED
#endif /* _SIGN_DEFINED */
double __cdecl cos(_In_ double _X);
double __cdecl cosh(_In_ double _X);
double __cdecl exp(_In_ double _X);
_CRT_JIT_INTRINSIC double __cdecl fabs(_In_ double _X);
double __cdecl fmod(_In_ double _X, _In_ double _Y);
double __cdecl log(_In_ double _X);
double __cdecl log10(_In_ double _X);
double __cdecl pow(_In_ double _X, _In_ double _Y);
double __cdecl sin(_In_ double _X);
double __cdecl sinh(_In_ double _X);
double __cdecl tan(_In_ double _X);
double __cdecl tanh(_In_ double _X);
double __cdecl sqrt(_In_ double _X);
#ifndef _CRT_ATOF_DEFINED
#define _CRT_ATOF_DEFINED
_Check_return_ _CRTIMP double __cdecl atof(_In_z_ const char *_String);
_Check_return_ _CRTIMP double __cdecl _atof_l(_In_z_ const char *_String, _In_opt_ _locale_t _Locale);
#endif /* _CRT_ATOF_DEFINED */
_CRTIMP double __cdecl _cabs(_In_ struct _complex _Complex_value);
_CRTIMP double __cdecl ceil(_In_ double _X);
_CRTIMP double __cdecl floor(_In_ double _X);
_CRTIMP double __cdecl frexp(_In_ double _X, _Out_ int * _Y);
_CRTIMP double __cdecl _hypot(_In_ double _X, _In_ double _Y);
_CRTIMP float __cdecl _hypotf(_In_ float _X, _In_ float _Y);
_CRTIMP double __cdecl _j0(_In_ double _X );
_CRTIMP double __cdecl _j1(_In_ double _X );
_CRTIMP double __cdecl _jn(int _X, _In_ double _Y);
_CRTIMP double __cdecl ldexp(_In_ double _X, _In_ int _Y);
#ifndef _CRT_MATHERR_DEFINED
#define _CRT_MATHERR_DEFINED
#if defined (MRTDLL) || defined (_M_CEE_PURE)
int __CRTDECL _matherr(_Inout_ struct _exception * _Except);
#else /* defined (MRTDLL) || defined (_M_CEE_PURE) */
int __cdecl _matherr(_Inout_ struct _exception * _Except);
#endif /* defined (MRTDLL) || defined (_M_CEE_PURE) */
#endif /* _CRT_MATHERR_DEFINED */
_CRTIMP double __cdecl modf(_In_ double _X, _Out_ double * _Y);
_CRTIMP double __cdecl _y0(_In_ double _X);
_CRTIMP double __cdecl _y1(_In_ double _X);
_CRTIMP double __cdecl _yn(_In_ int _X, _In_ double _Y);
/* hypot and hypotf are now part of the C99 Standard */
#if !defined (RC_INVOKED) && !defined (__midl)
static __inline double __CRTDECL hypot(_In_ double _X, _In_ double _Y)
{
return _hypot(_X, _Y);
}
static __inline float __CRTDECL hypotf(_In_ float _X, _In_ float _Y)
{
return _hypotf(_X, _Y);
}
#endif /* !defined (RC_INVOKED) && !defined (__midl) */
#if defined (_M_IX86)
_CRTIMP int __cdecl _set_SSE2_enable(_In_ int _Flag);
#endif /* defined (_M_IX86) */
#if defined (_M_IA64)
/* ANSI C, 4.5 Mathematics */
/* 4.5.2 Trigonometric functions */
_CRTIMP float __cdecl acosf( _In_ float _X);
_CRTIMP float __cdecl asinf( _In_ float _X);
_CRTIMP float __cdecl atanf( _In_ float _X);
_CRTIMP float __cdecl atan2f( _In_ float _Y, float _X);
_CRTIMP float __cdecl cosf( _In_ float _X);
_CRTIMP float __cdecl sinf( _In_ float _X);
_CRTIMP float __cdecl tanf( _In_ float _X);
/* 4.5.3 Hyperbolic functions */
_CRTIMP float __cdecl coshf( _In_ float _X);
_CRTIMP float __cdecl sinhf( _In_ float _X);
_CRTIMP float __cdecl tanhf( _In_ float _X);
/* 4.5.4 Exponential and logarithmic functions */
_CRTIMP float __cdecl expf( _In_ float _X);
_CRTIMP float __cdecl logf( _In_ float _X);
_CRTIMP float __cdecl log10f( _In_ float _X);
_CRTIMP float __cdecl modff( float _X, _Out_ float* _Y);
/* 4.5.5 Power functions */
_CRTIMP float __cdecl powf( _In_ float _Base, _In_ float _Exp);
_CRTIMP float __cdecl sqrtf( _In_ float _X);
/* 4.5.6 Nearest integer, absolute value, and remainder functions */
_CRTIMP float __cdecl ceilf( _In_ float _X);
_CRT_JIT_INTRINSIC _CRTIMP float __cdecl fabsf( _In_ float _X);
_CRTIMP float __cdecl floorf( _In_ float _X);
_CRTIMP float __cdecl fmodf( _In_ float _X, _In_ float _Y);
_CRTIMP float __cdecl ldexpf(_In_ float _X, _In_ int _Y);
#endif /* defined (_M_IA64) */
#if defined (_M_AMD64)
/* ANSI C, 4.5 Mathematics */
/* 4.5.2 Trigonometric functions */
_CRTIMP float __cdecl acosf( _In_ float _X);
_CRTIMP float __cdecl asinf( _In_ float _X);
_CRTIMP float __cdecl atanf( _In_ float _X);
_CRTIMP float __cdecl atan2f( _In_ float _Y, _In_ float _X);
_CRTIMP float __cdecl cosf( _In_ float _X);
_CRTIMP float __cdecl sinf( _In_ float _X);
_CRTIMP float __cdecl tanf( _In_ float _X);
/* 4.5.3 Hyperbolic functions */
_CRTIMP float __cdecl coshf( _In_ float _X);
_CRTIMP float __cdecl sinhf( _In_ float _X);
_CRTIMP float __cdecl tanhf( _In_ float _X);
/* 4.5.4 Exponential and logarithmic functions */
_CRTIMP float __cdecl expf( _In_ float _X);
_CRTIMP float __cdecl logf( _In_ float _X);
_CRTIMP float __cdecl log10f( _In_ float _X);
_CRTIMP float __cdecl modff( _In_ float _X, _Out_ float* _Y);
/* 4.5.5 Power functions */
_CRTIMP float __cdecl powf( _In_ float _X, _In_ float _Y);
_CRTIMP float __cdecl sqrtf( _In_ float _X);
/* 4.5.6 Nearest integer, absolute value, and remainder functions */
_CRTIMP float __cdecl ceilf( _In_ float _X);
_CRTIMP float __cdecl floorf( _In_ float _X);
_CRTIMP float __cdecl fmodf( _In_ float _X, _In_ float _Y);
_CRTIMP float __cdecl _copysignf (_In_ float _Number, _In_ float _Sign);
_CRTIMP float __cdecl _chgsignf (_In_ float _X);
_CRTIMP float __cdecl _logbf(_In_ float _X);
_CRTIMP float __cdecl _nextafterf(_In_ float _X, _In_ float _Y);
_CRTIMP int __cdecl _finitef(_In_ float _X);
_CRTIMP int __cdecl _isnanf(_In_ float _X);
_CRTIMP int __cdecl _fpclassf(_In_ float _X);
#endif /* defined (_M_AMD64) */
/* Macros defining long double functions to be their double counterparts
* (long double is synonymous with double in this implementation).
*/
#ifndef __cplusplus
#define acosl(x) ((long double)acos((double)(x)))
#define asinl(x) ((long double)asin((double)(x)))
#define atanl(x) ((long double)atan((double)(x)))
#define atan2l(y,x) ((long double)atan2((double)(y), (double)(x)))
#define ceill(x) ((long double)ceil((double)(x)))
#define cosl(x) ((long double)cos((double)(x)))
#define coshl(x) ((long double)cosh((double)(x)))
#define expl(x) ((long double)exp((double)(x)))
#define fabsl(x) ((long double)fabs((double)(x)))
#define floorl(x) ((long double)floor((double)(x)))
#define fmodl(x,y) ((long double)fmod((double)(x), (double)(y)))
#define frexpl(x,y) ((long double)frexp((double)(x), (y)))
#define _hypotl(x,y) ((long double)_hypot((double)(x), (double)(y)))
#define hypotl(x,y) ((long double)_hypot((double)(x), (double)(y)))
#define ldexpl(x,y) ((long double)ldexp((double)(x), (y)))
#define logl(x) ((long double)log((double)(x)))
#define log10l(x) ((long double)log10((double)(x)))
#define _matherrl _matherr
#define modfl(x,y) ((long double)modf((double)(x), (double *)(y)))
#define powl(x,y) ((long double)pow((double)(x), (double)(y)))
#define sinl(x) ((long double)sin((double)(x)))
#define sinhl(x) ((long double)sinh((double)(x)))
#define sqrtl(x) ((long double)sqrt((double)(x)))
#define tanl(x) ((long double)tan((double)(x)))
#define tanhl(x) ((long double)tanh((double)(x)))
#define _chgsignl(x) ((long double)_chgsign((double)(x)))
#define _copysignl(x,y) ((long double)_copysign((double)(x), (double)(y)))
#define frexpf(x,y) ((float)frexp((double)(x),(y)))
#if !defined (_M_IA64)
#define fabsf(x) ((float)fabs((double)(x)))
#define ldexpf(x,y) ((float)ldexp((double)(x),(y)))
#if !defined (_M_AMD64)
#define acosf(x) ((float)acos((double)(x)))
#define asinf(x) ((float)asin((double)(x)))
#define atanf(x) ((float)atan((double)(x)))
#define atan2f(y,x) ((float)atan2((double)(y), (double)(x)))
#define ceilf(x) ((float)ceil((double)(x)))
#define cosf(x) ((float)cos((double)(x)))
#define coshf(x) ((float)cosh((double)(x)))
#define expf(x) ((float)exp((double)(x)))
#define floorf(x) ((float)floor((double)(x)))
#define fmodf(x,y) ((float)fmod((double)(x), (double)(y)))
#define logf(x) ((float)log((double)(x)))
#define log10f(x) ((float)log10((double)(x)))
#define modff(x,y) ((float)modf((double)(x), (double *)(y)))
#define powf(x,y) ((float)pow((double)(x), (double)(y)))
#define sinf(x) ((float)sin((double)(x)))
#define sinhf(x) ((float)sinh((double)(x)))
#define sqrtf(x) ((float)sqrt((double)(x)))
#define tanf(x) ((float)tan((double)(x)))
#define tanhf(x) ((float)tanh((double)(x)))
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -