C 之cmath常用庫函式一覽

2021-08-13 16:16:14 字數 1236 閱讀 2168

cmath是c++語言中的庫函式,其中的c表示函式是來自c標準庫的函式,math為數學常用庫函式。

cmath中常用庫函式:

int abs(int i);//返回整型引數i的絕對值

double fabs(double x);//返回雙精度引數x的絕對值

long labs(long n);//返回長整型引數n的絕對值

double exp(double x);//返回指數函式e^x的值

double log(double x);//返回logex的值

double log10(double x) 返回log10x的值

double pow(double x,double y) 返回x^y的值

double pow10(int p) 返回10^p的值

double sqrt(double x) 返回+√x的值

double acos(double x) 返回x的反余弦arccos(x)值,x為弧度

double asin(double x) 返回x的反正弦arcsin(x)值,x為弧度

double atan(double x) 返回x的反正切arctan(x)值,x為弧度

double cos(double x) 返回x的余弦cos(x)值,x為弧度

double sin(double x) 返回x的正弦sin(x)值,x為弧度

double tan(double x) 返回x的正切tan(x)值,x為弧度

double hypot(double x,double y) 返回直角三角形斜邊的長度(z),

x和y為直角邊的長度,z^2=x^2+y^2

double ceil(double x) 返回不小於x的最小整數

double floor(double x) 返回不大於x的最大整數

int rand() 產生乙個隨機數並返回這個數

double atof(char *nptr) 將字串nptr轉換成浮點數並返回這個浮點數

double atol(char *nptr) 將字串nptr轉換成長整數並返回這個整數

double atof(char *nptr) 將字串nptr轉換成雙精度數,並返回這個數,錯誤返回0

int atoi(char *nptr) 將字串nptr轉換成整型數, 並返回這個數,錯誤返回0

long atol(char *nptr) 將字串nptr轉換成長整型數,並返回這個數,錯誤返回0

PHP的GD庫函式一覽

php的gd庫函式一覽 getimagesize 用法 array getimagesize string filename,array imageinfo imagearc 作用 畫弧線 用法 int imagearc int im,int cx,int cy,int w,int h,int s,...

c 學習之常用時間函式一覽

本地時間 utc 時區差 本地時間 utc 世界協調時 以地球自轉為基礎的時間標準。gmt 世界時,格林威治時間 對地球轉速週期性差異進行校正後的世界時。一般將 gmt utc 當作同一時間對待。獲取當前時間可以使用 time 函式,該函式用於返回系統的當前日曆時間,該時間使用自 1970 年 1 ...

vb常用函式一覽表

數學函式 函式功能 示例結果 說明abs x 絕對值abs 50.3 50.3 exp x 自然指數 exp 2 e ee 自然對數的底 的某次方 fix x 取整 取引數的整數部分 fix 99.8 99int x 取整 取小於或等於引數的最大整數 int 99.8 int 99.8 100 99...