lua math libary
| 函数名 | 描述 | 示例 | 结果 |
| pi | 圆周率 | math.pi | 3.1415926535898 |
| abs | 取绝对值 | math.abs(-2012) | 2012 |
| ceil | 向上取整 | math.ceil(9.1) | 10 |
| floor | 向下取整 | math.floor(9.9) | 9 |
| max | 取参数最大值 | math.max(2,4,6,8) | 8 |
| min | 取参数最小值 | math.min(2,4,6,8) | 2 |
| pow | 计算x的y次幂 | math.pow(2,16) | 65536 |
| sqrt | 开平方 | math.sqrt(65536) | 256 |
| mod | 取模 | math.mod(65535,2) | 1 |
| modf | 取整数和小数部分 | math.modf(20.12) | 20 0.12 |
| randomseed | 设随机数种子 | math.randomseed(os.time()) | |
| random | 取随机数 | math.random(5,90) | 5~90 |
| rad | 角度转弧度 | math.rad(180) | 3.1415926535898 |
| deg | 弧度转角度 | math.deg(math.pi) | 180 |
| exp | e的x次方 | math.exp(4) | 54.598150033144 |
| log | 计算x的自然对数 | math.log(54.598150033144) | 4 |
| log10 | 计算10为底,x的对数 | math.log10(1000) | 3 |
| frexp | 将参数拆成x * (2 ^ y)的形式 | math.frexp(160) | 0.625 8 |
| ldexp | 计算x * (2 ^ y) | math.ldexp(0.625,8) | 160 |
| sin | 正弦 | math.sin(math.rad(30)) | 0.5 |
| cos | 余弦 | math.cos(math.rad(60)) | 0.5 |
| tan | 正切 | math.tan(math.rad(45)) | 1 |
| asin | 反正弦 | math.deg(math.asin(0.5)) | 30 |
| acos | 反余弦 | math.deg(math.acos(0.5)) | 60 |
| atan | 反正切 | math.deg(math.atan(1)) | 45 |
| 函数名 | 描述 | 示例 | 结果 |
| pi | 圆周率 | math.pi | 3.1415926535898 |
| abs | 取绝对值 | math.abs(-2012) | 2012 |
| ceil | 向上取整 | math.ceil(9.1) | 10 |
| floor | 向下取整 | math.floor(9.9) | 9 |
| max | 取参数最大值 | math.max(2,4,6,8) | 8 |
| min | 取参数最小值 | math.min(2,4,6,8) | 2 |
| pow | 计算x的y次幂 | math.pow(2,16) | 65536 |
| sqrt | 开平方 | math.sqrt(65536) | 256 |
| mod | 取模 | math.mod(65535,2) | 1 |
| modf | 取整数和小数部分 | math.modf(20.12) | 20 0.12 |
| randomseed | 设随机数种子 | math.randomseed(os.time()) | |
| random | 取随机数 | math.random(5,90) | 5~90 |
| rad | 角度转弧度 | math.rad(180) | 3.1415926535898 |
| deg | 弧度转角度 | math.deg(math.pi) | 180 |
| exp | e的x次方 | math.exp(4) | 54.598150033144 |
| log | 计算x的自然对数 | math.log(54.598150033144) | 4 |
| log10 | 计算10为底,x的对数 | math.log10(1000) | 3 |
| frexp | 将参数拆成x * (2 ^ y)的形式 | math.frexp(160) | 0.625 8 |
| ldexp | 计算x * (2 ^ y) | math.ldexp(0.625,8) | 160 |
| sin | 正弦 | math.sin(math.rad(30)) | 0.5 |
| cos | 余弦 | math.cos(math.rad(60)) | 0.5 |
| tan | 正切 | math.tan(math.rad(45)) | 1 |
| asin | 反正弦 | math.deg(math.asin(0.5)) | 30 |
| acos | 反余弦 | math.deg(math.acos(0.5)) | 60 |
| atan | 反正切 | math.deg(math.atan(1)) | 45 |
lua math libary的更多相关文章
- lua math 库
lua math库 (2012-05-18 17:26:28) 转载▼ 标签: 游戏 分类: Lua atan2.sinh.cosh.tanh这4个应该用不到. 函数名 描述 示例 结果 pi 圆周率 ...
- Lua math库
函数名 描述 示例 结果 pi 圆周率 math.pi 3.1415926535898 abs 取绝对值 math.abs(-2012) 2012 ceil 向上取整 math.ceil(9.1) 1 ...
- lua math.random()
math.random([n [,m]]) 用法:1.无参调用,产生[0, 1)之间的浮点随机数. 2.一个参数n,产生[1, n]之间的整数. 3.两个参数,产生[n, m]之间的整数. math. ...
- lua function
This is the main reference for the World of Warcraft Lua Runtime. Note that these are mostly standar ...
- lua学习笔记(2)-常用调用
assert(loadstring("math.max(7,8,9)"))dofile("scripts/xxx.lua")math.floor()math.r ...
- math.floor实现四舍五入
lua math.floor 实现四舍五入: lua 中的math.floor函数是向下取整函数. math.floor(5.123) -- 5 math.floor(5.523) -- 5 用此特 ...
- 深入redis内部--初始化服务器
初始化服务器代码如下: void initServer() { int j; signal(SIGHUP, SIG_IGN); signal(SIGPIPE, SIG_IGN); setupSigna ...
- Redis(四):独立功能的实现
发布与订阅 Redis 的发布与订阅功能有PUBLISH命令,SUBSCRIBE命令,PSUBSCRIBE命令,PUBSUB命令等组成. 客户端可以通过SUBSCRIBE命令订阅一个或多个频道,当其它 ...
- Lua之math
Lua之math函数: 转载请注明出处:http://www.cnblogs.com/jietian331/p/8032555.html abs 取绝对值 math.abs(-15) 15 acos ...
随机推荐
- HTTP状态码(HTTP Status Code)【转】
HTTP状态码(HTTP Status Code) 一些常见的状态码为: 200 - 服务器成功返回网页 404 - 请求的网页不存在 503 - 服务不可用 所有状态解释:点击查看 1xx(临时响应 ...
- 浅谈android的selector,背景选择器
shape和selector的结合使用 (2013-04-07 11:11:00) 转载▼ 分类: android 1.Shape (1)作用:XML中定义的几何形状 (2)位置:res/draw ...
- Sass介绍及入门教程
Sass是什么? Sass是"Syntactically Awesome StyleSheets"的简称.那么他是什么?其实没有必要太过于纠结,只要知道他是“CSS预处理器”中的一 ...
- [转载]解析WINDOWS中的DLL文件---经典DLL解读
[转载]解析WINDOWS中的DLL文件---经典DLL解读 在Windows世界中,有无数块活动的大陆,它们都有一个共同的名字——动态链接库.现在就走进这些神奇的活动大陆,找出它们隐藏已久的秘密吧! ...
- 学习Java这几个快捷键你得知道(不断更新中)
java中的System.out.println();的快捷键 --------先输入sysout 在按 alt + /
- html系列教程--center dl dt dd div
<center> 标签:对其所包括的文本进行水平居中. <datalist> 标签:定义列表,与 input 元素配合使用该元素,来定义 input 可能的值 demo: &l ...
- nide.js(二)文件I/O
文件I/O fs模块的基本用法 node.js中提供一个名为fs的模块来支持I/O操作,fs模块的文件I/O是对标准POSIX函数的简单封装. 1.writeFile函数的基本用法 文件I/O,写入是 ...
- JAVA-反射-getGenericSuperclass()
1 public class Person<T> { 2 3 } 4 5 import java.lang.reflect.ParameterizedType; 6 import java ...
- 在EL表达式或者Struts标签库中格式化日期对象,即将Date转换为yyyy-MM-dd格式
一.EL表达式 首先,在jsp页面引入<fmt> tags,<%@ taglib prefix="fmt" uri="http://java.sun.c ...
- iOS 任意类型数据转换字符串
//转换数据类型: NSError *parseError = nil; NSData *jsonData = [NSJSONSerialization dataWithJSONObject:resp ...