math.h一般見(jiàn)于C程序設(shè)計(jì),#include 是包含math頭文件的意思, .h是頭文件的擴(kuò)展名(header file),這一句聲明了本程序要用到標(biāo)準(zhǔn)庫(kù)中的 math.h文件。math.h頭文件中聲明了常用的一些數(shù)學(xué)運(yùn)算,比如乘方,開(kāi)方運(yùn)算等等。1
math.h概述math.h頭文件定義了各種數(shù)學(xué)函數(shù)和一個(gè)宏。
庫(kù)宏下面是這個(gè)庫(kù)中定義的唯一的一個(gè)宏:
HUGE_VAL
當(dāng)函數(shù)的結(jié)果不可以表示為浮點(diǎn)數(shù)時(shí)。如果是因?yàn)榻Y(jié)果的幅度太大以致于無(wú)法表示,則函數(shù)會(huì)設(shè)置 errno 為 ERANGE 來(lái)表示范圍錯(cuò)誤,并返回一個(gè)由宏 HUGE_VAL 或者它的否定(- HUGE_VAL)命名的一個(gè)特定的很大的值。
如果結(jié)果的幅度太小,則會(huì)返回零值。在這種情況下,error 可能會(huì)被設(shè)置為 ERANGE,也有可能不會(huì)被設(shè)置為 ERANGE。2
庫(kù)函數(shù)數(shù)學(xué)函數(shù)庫(kù),一些數(shù)學(xué)計(jì)算的公式的具體實(shí)現(xiàn)是放在math.h里,具體有:3
1、 三角函數(shù)
double sin(double);正弦
double cos(double);余弦
double tan(double);正切
2 、反三角函數(shù)
double asin (double); 結(jié)果介于[-PI/2,PI/2]
double acos (double); 結(jié)果介于[0,PI]
double atan (double); 反正切(主值),結(jié)果介于[-PI/2,PI/2]
double atan2 (double,double); 反正切(整圓值),結(jié)果介于[-PI,PI]
3 、雙曲三角函數(shù)
double sinh (double);
double cosh (double);
double tanh (double);
4 、指數(shù)與對(duì)數(shù)
double frexp(double value,int *exp);這是一個(gè)將value值拆分成小數(shù)部分f和(以2為底的)指數(shù)部分exp,并返回小數(shù)部分f,即f*2^exp。其中f取值在0.5~1.0范圍或者0。
double ldexp(double x,int exp);這個(gè)函數(shù)剛好跟上面那個(gè)frexp函數(shù)功能相反,它的返回值是x*2^exp
double modf(double value,double *iptr);拆分value值,返回它的小數(shù)部分,iptr指向整數(shù)部分。
double log (double); 以e為底的對(duì)數(shù)
double log10 (double);以10為底的對(duì)數(shù)
double pow(double x,double y);計(jì)算x的y次冪
float powf(float x,float y); 功能與pow一致,只是輸入與輸出皆為單精度浮點(diǎn)數(shù)
double exp (double);求取自然數(shù)e的冪
double sqrt (double);開(kāi)平方根
5 、取整
double ceil (double); 取上整,返回不比x小的最小整數(shù)
double floor (double); 取下整,返回不比x大的最大整數(shù),即高斯函數(shù)[x]
6 、絕對(duì)值
double fabs (double);求實(shí)型的絕對(duì)值
double cabs(struct complex znum);求復(fù)數(shù)的絕對(duì)值
7 、標(biāo)準(zhǔn)化浮點(diǎn)數(shù)
double frexp (double f,int *p); 標(biāo)準(zhǔn)化浮點(diǎn)數(shù),f = x * 2^p,已知f求x,p (x介于[0.5,1])
double ldexp (double x,int p); 與frexp相反,已知x,p求f
8 、取整與取余
double modf (double,double*); 將參數(shù)的整數(shù)部分通過(guò)指針回傳,返回小數(shù)部分
double fmod (double,double); 返回兩參數(shù)相除的余數(shù)
9 、其他
double hypot(double x,double y);已知直角三角形兩個(gè)直角邊長(zhǎng)度,求斜邊長(zhǎng)度
double ldexp(double x,int exponent);計(jì)算x*(2的指數(shù)冪)
double poly(double x,int degree,double coeffs []);計(jì)算多項(xiàng)式
int matherr(struct exception *e);數(shù)學(xué)錯(cuò)誤計(jì)算處理程序
source: 《C & C++ Code Capsules》
注意事項(xiàng)沒(méi)有現(xiàn)成的cot三角函數(shù),可以使用tan(PI/2-x)來(lái)實(shí)現(xiàn)
double atan2(double y,double x);取值范圍在(PI,PI)之間;這是一個(gè)不太常見(jiàn)的函數(shù),主要用來(lái)返回y/x的反正切值。
強(qiáng)調(diào)一點(diǎn),1-3類(lèi) 傳參都是針對(duì)以弧度表示的數(shù)值,非角度表示的數(shù)值。
對(duì)于一般的對(duì)數(shù)求解,考慮利用數(shù)學(xué)上的對(duì)數(shù)轉(zhuǎn)換來(lái)實(shí)現(xiàn)。
關(guān)于fmod:考慮到%只適用與整型數(shù)據(jù),這里提出一個(gè)專門(mén)針對(duì)實(shí)型數(shù)據(jù)的取余運(yùn)算的函數(shù)。
int rand(void) 用這函數(shù)的時(shí)候記得要給隨機(jī)種子哦,要不得出的不是真正的隨機(jī)數(shù).產(chǎn)生隨機(jī)種子可以用srand((unsigned int)time(NULL));這就是由時(shí)間產(chǎn)生的隨機(jī)種子了。
在gcc中,需要使用-lm鏈接math庫(kù)文件方可使用。
math.h的內(nèi)容此文件為VS++2010中\(zhòng)Microsoft Visual Studio 10.0\VC\crt\src目錄下math.h的內(nèi)容。VS2010中\(zhòng)Microsoft Visual Studio 10.0\VC\include下也有一個(gè)math.h。
/****math.h-definitionsanddeclarationsformathlibrary**Copyright(c)MicrosoftCorporation.Allrightsreserved.**Purpose:*Thisfilecontainsconstantdefinitionsandexternalsubroutine*declarationsforthemathsubroutinelibrary.*[ANSI/SystemV]**[Public]*****/#ifndef_INC_MATH#define_INC_MATH#include/**Currently,allMSCcompilersforWin32platformsdefaultto8byte*alignment.*/#pragmapack(push,_CRT_PACKING)#ifdef__cplusplusextern"C"{#endif/*__cplusplus*/#ifndef__assembler/*Definitionof_exceptionstruct-thisstructispassedtothematherr*routinewhenafloatingpointexceptionisdetected*/#ifndef_EXCEPTION_DEFINEDstruct_exception{inttype;/*exceptiontype-seebelow*/char*name;/*nameoffunctionwhereerroroccured*/doublearg1;/*firstargumenttofunction*/doublearg2;/*secondargument(ifany)tofunction*/doubleretval;/*valuetobereturnedbyfunction*/};#define_EXCEPTION_DEFINED#endif/*_EXCEPTION_DEFINED*//*Definitionofa_complexstructtobeusedbythosewhousecabsand*wanttypecheckingontheirargument*/#ifndef_COMPLEX_DEFINEDstruct_complex{doublex,y;/*realandimaginaryparts*/};#if!__STDC__&&!defined(__cplusplus)/*Non-ANSInameforcompatibility*/#definecomplex_complex#endif/*!__STDC__&&!defined(__cplusplus)*/#define_COMPLEX_DEFINED#endif/*_COMPLEX_DEFINED*/#endif/*__assembler*//*Constantdefinitionsfortheexceptiontypepassedinthe_exceptionstruct*/#define_DOMAIN1/*argumentdomainerror*/#define_SING2/*argumentsingularity*/#define_OVERFLOW3/*overflowrangeerror*/#define_UNDERFLOW4/*underflowrangeerror*/#define_TLOSS5/*totallossofprecision*/#define_PLOSS6/*partiallossofprecision*/#defineEDOM33#defineERANGE34/*Definitionsof_HUGEandHUGE_VAL-respectivelytheXENⅨandANSInames*foravaluereturnedincaseoferrorbyanumberofthefloatingpoint*mathroutines*/#ifndef__assembler#if!defined(_M_CEE_PURE)_CRTIMPexterndouble_HUGE;#else/*!defined(_M_CEE_PURE)*/constdouble_HUGE=System::Double::PositiveInfinity;#endif/*!defined(_M_CEE_PURE)*/#endif/*__assembler*/#defineHUGE_VAL_HUGE/*Functionprototypes*/#if!defined(__assembler)#ifndef_CRT_ABS_DEFINED#define_CRT_ABS_DEFINEDint__cdeclabs(_In_int_X);long__cdecllabs(_In_long_X);longlong__cdeclllabs(_In_longlong_X);#endif/*_CRT_ABS_DEFINED*/double__cdeclacos(_In_double_X);double__cdeclasin(_In_double_X);double__cdeclatan(_In_double_X);double__cdeclatan2(_In_double_Y,_In_double_X);#ifndef_SIGN_DEFINED_Check_return__CRTIMPdouble__cdecl_copysign(_In_double_Number,_In_double_Sign);_Check_return__CRTIMPdouble__cdecl_chgsign(_In_double_X);#define_SIGN_DEFINED#endif/*_SIGN_DEFINED*/double__cdeclcos(_In_double_X);double__cdeclcosh(_In_double_X);double__cdeclexp(_In_double_X);_CRT_JIT_INTRINSICdouble__cdeclfabs(_In_double_X);double__cdeclfmod(_In_double_X,_In_double_Y);double__cdecllog(_In_double_X);double__cdecllog10(_In_double_X);double__cdeclpow(_In_double_X,_In_double_Y);double__cdeclsin(_In_double_X);double__cdeclsinh(_In_double_X);double__cdecltan(_In_double_X);double__cdecltanh(_In_double_X);double__cdeclsqrt(_In_double_X);#ifndef_CRT_ATOF_DEFINED#define_CRT_ATOF_DEFINED_Check_return__CRTIMPdouble__cdeclatof(_In_z_constchar*_String);_Check_return__CRTIMPdouble__cdecl_atof_l(_In_z_constchar*_String,_In_opt__locale_t_Locale);#endif/*_CRT_ATOF_DEFINED*/_CRTIMPdouble__cdecl_cabs(_In_struct_complex_Complex_value);_CRTIMPdouble__cdeclceil(_In_double_X);_CRTIMPdouble__cdeclfloor(_In_double_X);_CRTIMPdouble__cdeclfrexp(_In_double_X,_Out_int*_Y);_CRTIMPdouble__cdecl_hypot(_In_double_X,_In_double_Y);_CRTIMPfloat__cdecl_hypotf(_In_float_X,_In_float_Y);_CRTIMPdouble__cdecl_j0(_In_double_X);_CRTIMPdouble__cdecl_j1(_In_double_X);_CRTIMPdouble__cdecl_jn(int_X,_In_double_Y);_CRTIMPdouble__cdeclldexp(_In_double_X,_In_int_Y);#ifndef_CRT_MATHERR_DEFINED#define_CRT_MATHERR_DEFINED#ifdefined(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*/_CRTIMPdouble__cdeclmodf(_In_double_X,_Out_double*_Y);_CRTIMPdouble__cdecl_y0(_In_double_X);_CRTIMPdouble__cdecl_y1(_In_double_X);_CRTIMPdouble__cdecl_yn(_In_int_X,_In_double_Y);/*hypotandhypotfarenowpartoftheC99Standard*/#if!defined(RC_INVOKED)&&!defined(__midl)static__inlinedouble__CRTDECLhypot(_In_double_X,_In_double_Y){return_hypot(_X,_Y);}static__inlinefloat__CRTDECLhypotf(_In_float_X,_In_float_Y){return_hypotf(_X,_Y);}#endif/*!defined(RC_INVOKED)&&!defined(__midl)*/#ifdefined(_M_Ⅸ86)_CRTIMPint__cdecl_set_SSE2_enable(_In_int_Flag);#endif/*defined(_M_Ⅸ86)*/#ifdefined(_M_IA64)/*ANSIC,4.5Mathematics*//*4.5.2Trigonometricfunctions*/_CRTIMPfloat__cdeclacosf(_In_float_X);_CRTIMPfloat__cdeclasinf(_In_float_X);_CRTIMPfloat__cdeclatanf(_In_float_X);_CRTIMPfloat__cdeclatan2f(_In_float_Y,float_X);_CRTIMPfloat__cdeclcosf(_In_float_X);_CRTIMPfloat__cdeclsinf(_In_float_X);_CRTIMPfloat__cdecltanf(_In_float_X);/*4.5.3Hyperbolicfunctions*/_CRTIMPfloat__cdeclcoshf(_In_float_X);_CRTIMPfloat__cdeclsinhf(_In_float_X);_CRTIMPfloat__cdecltanhf(_In_float_X);/*4.5.4Exponentialandlogarithmicfunctions*/_CRTIMPfloat__cdeclexpf(_In_float_X);_CRTIMPfloat__cdecllogf(_In_float_X);_CRTIMPfloat__cdecllog10f(_In_float_X);_CRTIMPfloat__cdeclmodff(float_X,_Out_float*_Y);/*4.5.5Powerfunctions*/_CRTIMPfloat__cdeclpowf(_In_float_Base,_In_float_Exp);_CRTIMPfloat__cdeclsqrtf(_In_float_X);/*4.5.6Nearestinteger,absolutevalue,andremainderfunctions*/_CRTIMPfloat__cdeclceilf(_In_float_X);_CRT_JIT_INTRINSIC_CRTIMPfloat__cdeclfabsf(_In_float_X);_CRTIMPfloat__cdeclfloorf(_In_float_X);_CRTIMPfloat__cdeclfmodf(_In_float_X,_In_float_Y);_CRTIMPfloat__cdeclldexpf(_In_float_X,_In_int_Y);#endif/*defined(_M_IA64)*/#ifdefined(_M_AMD64)/*ANSIC,4.5Mathematics*//*4.5.2Trigonometricfunctions*/_CRTIMPfloat__cdeclacosf(_In_float_X);_CRTIMPfloat__cdeclasinf(_In_float_X);_CRTIMPfloat__cdeclatanf(_In_float_X);_CRTIMPfloat__cdeclatan2f(_In_float_Y,_In_float_X);_CRTIMPfloat__cdeclcosf(_In_float_X);_CRTIMPfloat__cdeclsinf(_In_float_X);_CRTIMPfloat__cdecltanf(_In_float_X);/*4.5.3Hyperbolicfunctions*/_CRTIMPfloat__cdeclcoshf(_In_float_X);_CRTIMPfloat__cdeclsinhf(_In_float_X);_CRTIMPfloat__cdecltanhf(_In_float_X);/*4.5.4Exponentialandlogarithmicfunctions*/_CRTIMPfloat__cdeclexpf(_In_float_X);_CRTIMPfloat__cdecllogf(_In_float_X);_CRTIMPfloat__cdecllog10f(_In_float_X);_CRTIMPfloat__cdeclmodff(_In_float_X,_Out_float*_Y);/*4.5.5Powerfunctions*/_CRTIMPfloat__cdeclpowf(_In_float_X,_In_float_Y);_CRTIMPfloat__cdeclsqrtf(_In_float_X);/*4.5.6Nearestinteger,absolutevalue,andremainderfunctions*/_CRTIMPfloat__cdeclceilf(_In_float_X);_CRTIMPfloat__cdeclfloorf(_In_float_X);_CRTIMPfloat__cdeclfmodf(_In_float_X,_In_float_Y);_CRTIMPfloat__cdecl_copysignf(_In_float_Number,_In_float_Sign);_CRTIMPfloat__cdecl_chgsignf(_In_float_X);_CRTIMPfloat__cdecl_logbf(_In_float_X);_CRTIMPfloat__cdecl_nextafterf(_In_float_X,_In_float_Y);_CRTIMPint__cdecl_finitef(_In_float_X);_CRTIMPint__cdecl_isnanf(_In_float_X);_CRTIMPint__cdecl_fpclassf(_In_float_X);#endif/*defined(_M_AMD64)*//*Macrosdefininglongdoublefunctionstobetheirdoublecounterparts*(longdoubleissynonymouswithdoubleinthisimplementation).*/#ifndef__cplusplus#defineacosl(x)((longdouble)acos((double)(x)))#defineasinl(x)((longdouble)asin((double)(x)))#defineatanl(x)((longdouble)atan((double)(x)))#defineatan2l(y,x)((longdouble)atan2((double)(y),(double)(x)))#defineceill(x)((longdouble)ceil((double)(x)))#definecosl(x)((longdouble)cos((double)(x)))#definecoshl(x)((longdouble)cosh((double)(x)))#defineexpl(x)((longdouble)exp((double)(x)))#definefabsl(x)((longdouble)fabs((double)(x)))#definefloorl(x)((longdouble)floor((double)(x)))#definefmodl(x,y)((longdouble)fmod((double)(x),(double)(y)))#definefrexpl(x,y)((longdouble)frexp((double)(x),(y)))#define_hypotl(x,y)((longdouble)_hypot((double)(x),(double)(y)))#definehypotl(x,y)((longdouble)_hypot((double)(x),(double)(y)))#defineldexpl(x,y)((longdouble)ldexp((double)(x),(y)))#definelogl(x)((longdouble)log((double)(x)))#definelog10l(x)((longdouble)log10((double)(x)))#define_matherrl_matherr#definemodfl(x,y)((longdouble)modf((double)(x),(double*)(y)))#definepowl(x,y)((longdouble)pow((double)(x),(double)(y)))#definesinl(x)((longdouble)sin((double)(x)))#definesinhl(x)((longdouble)sinh((double)(x)))#definesqrtl(x)((longdouble)sqrt((double)(x)))#definetanl(x)((longdouble)tan((double)(x)))#definetanhl(x)((longdouble)tanh((double)(x)))#define_chgsignl(x)((longdouble)_chgsign((double)(x)))#define_copysignl(x,y)((longdouble)_copysign((double)(x),(double)(y)))#definefrexpf(x,y)((float)frexp((double)(x),(y)))#if!defined(_M_IA64)#definefabsf(x)((float)fabs((double)(x)))#defineldexpf(x,y)((float)ldexp((double)(x),(y)))#if!defined(_M_AMD64)#defineacosf(x)((float)acos((double)(x)))#defineasinf(x)((float)asin((double)(x)))#defineatanf(x)((float)atan((double)(x)))#defineatan2f(y,x)((float)atan2((double)(y),(double)(x)))#defineceilf(x)((float)ceil((double)(x)))#definecosf(x)((float)cos((double)(x)))#definecoshf(x)((float)cosh((double)(x)))#defineexpf(x)((float)exp((double)(x)))#definefloorf(x)((float)floor((double)(x)))#definefmodf(x,y)((float)fmod((double)(x),(double)(y)))#definelogf(x)((float)log((double)(x)))#definelog10f(x)((float)log10((double)(x)))#definemodff(x,y)((float)modf((double)(x),(double*)(y)))#definepowf(x,y)((float)pow((double)(x),(double)(y)))#definesinf(x)((float)sin((double)(x)))#definesinhf(x)((float)sinh((double)(x)))#definesqrtf(x)((float)sqrt((double)(x)))#definetanf(x)((float)tan((double)(x)))#definetanhf(x)((float)tanh((double)(x)))#endif/*!defined(_M_AMD64)*/#endif/*!defined(_M_IA64)*/#else/*__cplusplus*/inlinelongdoubleacosl(_In_longdouble_X){return(acos((double)_X));}inlinelongdoubleasinl(_In_longdouble_X){return(asin((double)_X));}inlinelongdoubleatanl(_In_longdouble_X){return(atan((double)_X));}inlinelongdoubleatan2l(_In_longdouble_Y,_In_longdouble_X){return(atan2((double)_Y,(double)_X));}inlinelongdoubleceill(_In_longdouble_X){return(ceil((double)_X));}inlinelongdoublecosl(_In_longdouble_X){return(cos((double)_X));}inlinelongdoublecoshl(_In_longdouble_X){return(cosh((double)_X));}inlinelongdoubleexpl(_In_longdouble_X){return(exp((double)_X));}inlinelongdoublefabsl(_In_longdouble_X){return(fabs((double)_X));}inlinelongdoublefloorl(_In_longdouble_X){return(floor((double)_X));}inlinelongdoublefmodl(_In_longdouble_X,_In_longdouble_Y){return(fmod((double)_X,(double)_Y));}inlinelongdoublefrexpl(_In_longdouble_X,_Out_int*_Y){return(frexp((double)_X,_Y));}inlinelongdoubleldexpl(_In_longdouble_X,_In_int_Y){return(ldexp((double)_X,_Y));}inlinelongdoublelogl(_In_longdouble_X){return(log((double)_X));}inlinelongdoublelog10l(_In_longdouble_X){return(log10((double)_X));}inlinelongdoublemodfl(_In_longdouble_X,_Out_longdouble*_Y){double_Di,_Df=modf((double)_X,&_Di);*_Y=(longdouble)_Di;return(_Df);}inlinelongdoublepowl(_In_longdouble_X,_In_longdouble_Y){return(pow((double)_X,(double)_Y));}inlinelongdoublesinl(_In_longdouble_X){return(sin((double)_X));}inlinelongdoublesinhl(_In_longdouble_X){return(sinh((double)_X));}inlinelongdoublesqrtl(_In_longdouble_X){return(sqrt((double)_X));}#ifndef_M_IA64inlinelongdoubletanl(_In_longdouble_X){return(tan((double)_X));}#else/*_M_IA64*/_CRTIMPlongdouble__cdecltanl(_In_longdouble_X);#endif/*_M_IA64*/inlinelongdoubletanhl(_In_longdouble_X){return(tanh((double)_X));}inlinelongdouble_chgsignl(_In_longdouble_Number){return_chgsign(static_cast(_Number));}inlinelongdouble_copysignl(_In_longdouble_Number,_In_longdouble_Sign){return_copysign(static_cast(_Number),static_cast(_Sign));}inlinefloatfrexpf(_In_float_X,_Out_int*_Y){return((float)frexp((double)_X,_Y));}#if!defined(_M_IA64)inlinefloatfabsf(_In_float_X){return((float)fabs((double)_X));}inlinefloatldexpf(_In_float_X,_In_int_Y){return((float)ldexp((double)_X,_Y));}#if!defined(_M_AMD64)inlinefloatacosf(_In_float_X){return((float)acos((double)_X));}inlinefloatasinf(_In_float_X){return((float)asin((double)_X));}inlinefloatatanf(_In_float_X){return((float)atan((double)_X));}inlinefloatatan2f(_In_float_Y,_In_float_X){return((float)atan2((double)_Y,(double)_X));}inlinefloatceilf(_In_float_X){return((float)ceil((double)_X));}inlinefloatcosf(_In_float_X){return((float)cos((double)_X));}inlinefloatcoshf(_In_float_X){return((float)cosh((double)_X));}inlinefloatexpf(_In_float_X){return((float)exp((double)_X));}inlinefloatfloorf(_In_float_X){return((float)floor((double)_X));}inlinefloatfmodf(_In_float_X,_In_float_Y){return((float)fmod((double)_X,(double)_Y));}inlinefloatlogf(_In_float_X){return((float)log((double)_X));}inlinefloatlog10f(_In_float_X){return((float)log10((double)_X));}inlinefloatmodff(_In_float_X,_Out_float*_Y){double_Di,_Df=modf((double)_X,&_Di);*_Y=(float)_Di;return((float)_Df);}inlinefloatpowf(_In_float_X,_In_float_Y){return((float)pow((double)_X,(double)_Y));}inlinefloatsinf(_In_float_X){return((float)sin((double)_X));}inlinefloatsinhf(_In_float_X){return((float)sinh((double)_X));}inlinefloatsqrtf(_In_float_X){return((float)sqrt((double)_X));}inlinefloattanf(_In_float_X){return((float)tan((double)_X));}inlinefloattanhf(_In_float_X){return((float)tanh((double)_X));}#endif/*!defined(_M_AMD64)*/#endif/*!defined(_M_IA64)*/#endif/*__cplusplus*/#endif/*!defined(__assembler)*/#if!__STDC__/*Non-ANSInamesforcompatibility*/#defineDOMAIN_DOMAIN#defineSING_SING#defineOVERFLOW_OVERFLOW#defineUNDERFLOW_UNDERFLOW#defineTLOSS_TLOSS#definePLOSS_PLOSS#definematherr_matherr#ifndef__assembler#if!defined(_M_CEE_PURE)_CRTIMPexterndoubleHUGE;#else/*!defined(_M_CEE_PURE)*/constdoubleHUGE=_HUGE;#endif/*!defined(_M_CEE_PURE)*/_CRT_NONSTDC_DEPRECATE(_cabs)_CRTIMPdouble__cdeclcabs(_In_struct_complex_X);_CRT_NONSTDC_DEPRECATE(_j0)_CRTIMPdouble__cdeclj0(_In_double_X);_CRT_NONSTDC_DEPRECATE(_j1)_CRTIMPdouble__cdeclj1(_In_double_X);_CRT_NONSTDC_DEPRECATE(_jn)_CRTIMPdouble__cdecljn(_In_int_X,_In_double_Y);_CRT_NONSTDC_DEPRECATE(_y0)_CRTIMPdouble__cdecly0(_In_double_X);_CRT_NONSTDC_DEPRECATE(_y1)_CRTIMPdouble__cdecly1(_In_double_X);_CRT_NONSTDC_DEPRECATE(_yn)_CRTIMPdouble__cdeclyn(_In_int_X,_In_double_Y);#endif/*__assembler*/#endif/*!__STDC__*/#ifdef__cplusplus}extern"C++"{templateinline_Ty_Pow_int(_Ty_X,int_Y){unsignedint_N;if(_Y>=0)_N=(unsignedint)_Y;else_N=(unsignedint)(-_Y);for(_Ty_Z=_Ty⑴;_X*=_X){if((_N&1)!=0)_Z*=_X;if((_N>>=1)==0)return(_Y