//指數運算
NSLog(@"%.f", pow(3,2) );//result 9
NSLog(@"%.f", pow(3,3) );//result 27
//開平方運算
NSLog(@"%.f", sqrt(16) );//result 4
NSLog(@"%.f", sqrt(81) );//result 9
//上捨入
NSLog(@"res: %.f", ceil(3.000000000001));//result 4
NSLog(@"res: %.f", ceil(3.00));//result 3
//下捨入
NSLog(@"res: %.f", floor(3.000000000001));//result 3
NSLog(@"res: %.f", floor(3.9999999));//result 3
floor函數:返回小於或者等於指定表達式的最大整數
//四捨五入
NSLog(@"res: %.f", round(3.5));//result 4
NSLog(@"res: %.f", round(3.46));//result 3
NSLog(@"res: %.f", round(-3.5));//NB: this one returns -4
//最小值
NSLog(@"res: %.f", fmin(5,10));//result 5
//最大值
NSLog(@"res: %.f", fmax(5,10));//result 10
//絕對值
NSLog(@"res: %.f", fabs(10));//result 10
NSLog(@"res: %.f", fabs(-10));//result 10