C语言的Math库 |
您所在的位置:网站首页 › math在c语言定义 › C语言的Math库 |
前言:
在蓝桥杯的官网上做了一道题,怎么做都不对,最后百度了一下,别人的代码只有几行,就是用了C语言中的Math库。。。。。 一生气,就了解了一下。 一.函数使用的参数值 _CRTIMP double __cdecl sin (double); _CRTIMP double __cdecl cos (double); _CRTIMP double __cdecl tan (double); _CRTIMP double __cdecl sinh (double); _CRTIMP double __cdecl cosh (double); _CRTIMP double __cdecl tanh (double); _CRTIMP double __cdecl asin (double); _CRTIMP double __cdecl acos (double); _CRTIMP double __cdecl atan (double); _CRTIMP double __cdecl atan2 (double, double); _CRTIMP double __cdecl exp (double); _CRTIMP double __cdecl log (double); _CRTIMP double __cdecl log10 (double); _CRTIMP double __cdecl pow (double, double); _CRTIMP double __cdecl sqrt (double); _CRTIMP double __cdecl ceil (double); _CRTIMP double __cdecl floor (double); _CRTIMP double __cdecl fabs (double); _CRTIMP double __cdecl ldexp (double, int); _CRTIMP double __cdecl frexp (double, int*); _CRTIMP double __cdecl modf (double, double*); _CRTIMP double __cdecl fmod (double, double); 二.简单函数 1.求绝对值函数:x=fabs(a); 作用:求a的绝对值;其中a可以是int型,float型,double型; 2.开平方函数:x=sqrt(a); 作用:求a的平方根;其中a可以是int型,float型,double型;a>=0; 三.三角函数 1.正弦函数函数:x=sin(a); 作用:求sin(a)的值,即a的正弦值;其中a可以是int型,float型,double型; 2.余弦函数函数:x=cos(a); 作用:求cos(a)的值,即a的余弦值;其中a可以是int型,float型,double型; 3.正切函数函数:x=tan(a); 作用:求tan(a)的值,即a的正切值;其中a可以是int型,float型,double型; 四.反三角函数 1.反正弦函数函数:x=asin(a); 作用:求(sin(a))^-1的值;其中a可以是int型,float型,double型; 2.反余弦函数函数:x=acos(a); 作用:求(cos(a))^-1的值;其中a可以是int型,float型,double型; 3.反正切函数函数:x=atan(a); 作用:求(tan(a))^-1的值;其中a可以是int型,float型,double型; 五.双曲三角函数 1.双曲正弦函数函数:x=sinh(a); 作用:计算a的双曲正弦函数sinh(a)的值;其中a可以是int型,float型,double型; 2.双曲余弦函数函数:x=cosh(a); 作用:计算a的双曲余弦函数cosh(a)的值;其中a可以是int型,float型,double型; 3.双曲正切函数函数:x=tanh(a); 作用:计算a的双曲正切函数tanh(a)的值;其中a可以是int型,float型,double型; 六.指数函数 1.e的幂函数:x=exp(a); 作用:求e^a的值;其中a可以是int型,float型,double型; 2.a^b函数:x=pow(a,b); 作用:求a^b的值;其中a,b可以是int型,float型,double型; 3.a/b的余数函数:x=fmod(a,b); 作用:求a/b的余数;其中a,b可以是int型,float型,double型; 4.frexp()函数:frexp(a,&b); 作用:把双精度数a分解为数字部分(尾数)x和以2为底的指数n,即a=x*2^n,n存放在b指向的变量中;其中a是double型; 七.对数函数 1.loge(a)函数:x=log(a); 作用:求以e为底数a的对数;其中a可以是int型,float型,double型; 2.log10(a)函数:x=log10(a); 作用:求以10为底数a的对数;其中a可以是int型,float型,double型; 八.取整 1.向上取整函数:x=ceil(a); 作用:求大于a的最小的整数;其中a可以是int型,float型,double型; 2.向下取整函数:x=floor(a); 作用:求不大于a的最大的整数;其中a可以是int型,float型,double型; |
今日新闻 |
推荐新闻 |
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |