Math Functions 常用函数
来源:互联网 发布:部落冲突蓝胖升级数据 编辑:程序博客网 时间:2024/05/17 03:55
//指数运算
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
参考:http://blog.sina.com.cn/s/blog_6d01cce301013ym7.html
- Math Functions 常用函数
- iOS --- 数学函数 Math Functions
- 常用函数 Functions 类
- Lua常用Math函数
- 常用Math函数
- 【Math类】常用函数
- java math常用函数
- oracle11g 常用函数(Functions)详解
- Math和Random常用函数
- java常用函数之math
- lua 的常用math 函数
- iOS中常用math函数
- Java中常用math函数
- math.h常用数学函数
- math.h中的常用函数
- js中的常用Math函数
- Objective-C Math functions
- Oracle 11g 常用函数(Functions)详解
- CIRCOS教程翻译 3.5——Ideogram Highlights
- Android中Acition和Category常量表
- linux命令多级目录的处理
- 测试类型 2
- 简单的oracle备份恢复批处理文件
- Math Functions 常用函数
- js字符串转换成xml并使用
- 算法的力量(转李开复)
- zoj3329——One Person Game(概率DP)
- Emmet:HTML/CSS代码快速编写神器
- C++中namespace的使用
- 抖灰面 (转)
- volatile 变量使用指南
- C# 打开指定文件夹或者文件 导入Excel