1浪漠、 三角函數(shù)
double sin (double);正弦
double cos (double);余弦
double tan (double);正切
(lldb) po sin(30*M_PI/180)
0.49999999999999994
(lldb) po cos(60*M_PI/180)
0.50000000000000011
(lldb) po tan(45*M_PI/180)
0.99999999999999988
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]
(lldb) po asin(0.5)
0.52359877559829882
(lldb) po 30*M_PI/180
0.52359877559829882
(lldb) po atan(1)
0.78539816339744828
(lldb) po 45*M_PI/180
0.78539816339744828
3 、雙曲三角函數(shù)
double sinh (double);
double cosh (double);
double tanh (double);
4 坐慰、指數(shù)與對(duì)數(shù)
double exp (double);求取自然數(shù)e的冪
double sqrt (double);開平方
double log (double); 以e為底的對(duì)數(shù)
double log10 (double);以10為底的對(duì)數(shù)
double pow(double x, double y);計(jì)算以x為底數(shù)的y次冪
float powf(float x, float y); 功能與pow一致较性,只是輸入與輸出皆為浮點(diǎn)數(shù)
(lldb) po exp(1)
2.7182818284590451
(lldb) po sqrt(4)
2
(lldb) po sqrt(9)
3
(lldb) po log(2.71828)
0.99999932734728202
(lldb) po log10(100)
2
(lldb) po log10(1000)
3
(lldb) po pow(2, 2)
4
(lldb) po pow(2, 3)
8
(lldb) po powf(2.0, 4.2)
18.3791714
(lldb) po pow(2, 3.2) (這個(gè)也可以浮點(diǎn)?)
9.1895868399762808
5 、取整
double ceil (double); 取上整
double floor (double); 取下整
(lldb) po ceil(10.1)
11
(lldb) po ceil(10.9)
11
(lldb) po floor(10.1)
10
(lldb) po floor(10.9)
10
6 结胀、絕對(duì)值
double fabs (double);求絕對(duì)值
double cabs(struct complex znum) ;求復(fù)數(shù)的絕對(duì)值
(lldb) po fabs(-10)
10
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ù)部分通過指針回傳, 返回小數(shù)部分
double fmod (double, double); 返回兩參數(shù)相除的余數(shù)
(lldb) po fmod(10, 3)
1
9 糟港、其他
double hypot(double x, double y);已知直角三角形兩個(gè)直角邊長(zhǎng)度攀操,求斜邊長(zhǎng)度
double ldexp(double x, int exponent);計(jì)算x * (2的exponent次冪)
double poly(double x, int degree, double coeffs [] );計(jì)算多項(xiàng)式
nt matherr(struct exception *e);數(shù)學(xué)錯(cuò)誤計(jì)算處理程序
(lldb) po ldexp(3, 0)
3
(lldb) po hypot(3, 4)
5
(lldb) po ldexp(3, 1)
6
(lldb) po ldexp(3, 2)
12
(lldb) po ldexp(3, 3)
24
(lldb) po ldexp(3, 4)
48
(lldb)