C语言中的math函数

Python010

C语言中的math函数,第1张

一些数学计算的公式的具体实现是放在math.h里,具体有:

double sin (double x) x的正弦值

double cos (double x) x的余弦值

double tan (double x) x的正切

double asin (double x) 结果介于[-PI/2, PI/2],x值域为[-1,1]

double acos (double x) 结果介于[0, PI],x值域为[-1,1]

double atan (double x) 反正切(主值), 结果介于[-PI/2, PI/2]

double atan2 (double y, double x) 反正切(整圆值), 结果介于[-PI, PI]

double sinh (double x) x的双曲正弦值

double cosh (double x) x的双曲余弦值

double tanh (double x) x的双曲正切值

double exp (double x) 幂函数e^x

double pow (double x, double y) x^y,如果x=0且y<=0,或者x<0且y不是整型数,将产生定义域错误

double sqrt (double x) x的平方根,其中x>=0

double log (double x) 以e为底的对数,自然对数,x>0

double log10 (double x) 以10为底的对数,x>0

double ceil (double x) 取上整

double floor (double x) 取下整

double fabs (double x) x的绝对值

double frexp (double x, int *exp) 标准化浮点数, x = f * 2^exp, 已知x求f, exp ( x介于[0.5, 1] )并返回f值

double ldexp (double x, int exp) 与frexp相反, 已知x, exp求x*2^exp

double modf (double x, double *ip) 将参数的整数部分通过指针回传, 返回小数部分,整数部分保存在*ip中

double fmod (double x, double y) 返回两参数相除x/y的余数,符号与x相同。如果y为0,则结果与具体的额实现有关

在C语言里面按一下CTRL+F1,选择header file、math.h就可以看到你要的东西,我看到了粘贴如下:

Functions

abs floor

acosfmod

asinfrexp

atanhypot

atan2 labs

atofldexp

cabslog

ceillog10

cos matherr

coshmodf

exp poly

fabspow

pow10 sqrt

sin tan

sinhtanh

Constants, data types, and global variables

complex exception

EDOMHUGE_VAL

ERANGE _mexcep