个人学习:lua数学库
2018-10-16 10:34
246 查看
个人学习:lua数学函数库
函数 | 作用 |
---|---|
math.abs(-15) = 15 | 取绝对值 |
math.acos(0.5) = 1.04719755 | 反余弦函数 |
math.asin(0.5) = 0.52359877 | 反正弦函数 |
math.atan2(90.0, 45.0) = 1.10714871 | x / y的反正切值 |
math.atan(0.5) = 0.463647609 | 反正切函数 |
math.ceil(5.8) = 6 | 不小于x的最小整数 |
math.cosh(0.5) = 1.276259652 | 双曲线余弦函数 |
math.cos(0.5) = 0.87758256 | 余弦函数 |
math.deg(math.pi) = 180 | 弧度转角度 |
math.exp(2) = 2.718281828 | 计算以e为底x次方值 |
math.floor(5.6) = 5 | 不大于x的最大整数 |
math.mod/fmod(14, 5) = 4 | 取模运算 |
math.frexp(10.0) = 0.625 4 | 把双精度数val分解为数字部分(尾数)和以2为底的指数n,即val=x*2n |
math.ldexp(10, 3) 运算结果为: 80 = 10 * (2 ^3) | 计算value * 2的n次方 |
math.log10(100) = 2 | 计算以10为基数的对数 |
math.log(2.71) = 0.9969 | 计算一个数字的自然对数 |
math.max(2.71, 100, -98, 23) = 100 | 取得参数中最大值 |
math.min(2.71, 100, -98, 23) = -98 | 取得参数中最小值 |
math.modf(15.98)运算结果为:15 98 | 把数分为整数和小数 |
math.pow(2, 5) = 32 | 得到x的y次方 |
math.rad(180) = 3.14159265358 | 角度转弧度 |
math.random(1, 100)或math.random(100) | 获取1-100的随机数 |
math.randomseed(os.time()) | 设置随机种子,在使用math.random函数之前必须使用此函数设置随机数种子 |
math.sinh(0.5) = 0.5210953 | 双曲线正弦函数 |
math.sin(math.rad(30)) = 0.5 | 正弦函数 |
math.sqrt(16) = 4 | 开平方 |
math.tanh(0.5) = 0.46211715 | 双曲线正切函数 |
math.tan(0.5) = 0.5463024 | 正切函数 |
相关文章推荐
- Lua语言基础个人学习笔记
- Lua学习笔记 第十八章 数学库
- 【Cocos2D学习】Lua——数学知识的基本应用
- 【原】lua个人学习记录(3)--导入动态库
- lua学习之表达式
- java学习之二(个人学习方法篇)
- 【个人学习笔记16之--浅谈UDF(用户自定义函数)】
- 关于lib 和 dll 个人学习总结
- idea建立maven管理springboot2的web项目过程(个人学习总结)
- 个人作业2——英语学习APP的案例分析
- cocos2d-x-LuaProxy学习日志(6) -- C/S通信交互之WebSocket
- 安卓个人学习------UI布局组件学习与整理简析
- 个人git链接和git学习心得总结
- AAA学习攻略-41 个人知识管理的25个方法
- 【学习Lua】ipairs函数和pairs函数之间有什么区别?
- 个人学习代码保存:例3. GridView相关练习操作
- 个人学习代码保存:例12.读取GridView文件中的数据到Excel文件
- Lua 学习笔记(四) —— 函数(一)
- Lua 入门学习笔记
- django 学习个人总结 之admin后台的使用,操作