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 ...
随机推荐
- 联想A208T ROOT
前几天,一直陪伴我的海信T89电池挂掉...胀胀的肚子...真可怜 一时之间找不到配套的电池,就借了个手机先用着,就是这 联想A208T ROOT... 话说的配置一般般,勉强够我这样的不怎么玩手机的 ...
- POJ2528线段树基础
開始就直接用延迟标记搞了下.最后发现内存肯定会爆了.数据太大了. 问了瓜神,原来应该用离散化来做这题,详细见凝视 #include <cstdio> #include <cstrin ...
- ACCESS 里面的坑
在vs2005中用sql语句访问access数据库出现replace函数未定义错误,后来查询得知,在不能用replace访问access. 问题: 1.为什么以前运行正常的Access数据库,搬到 ...
- velocity的foreach下标
velocity的foreach标签操作: #foreach( $per in ${list} ) #end 如果需要访问循环的当前目标的index可用通过${velocityCount},其默认是从 ...
- java:添加一条数据到数据库中文乱码
在数据库链接地址后面加上:characterEncoding=UTF8 如:jdbc\:mysql\://localhost\:3306/db_sjzdaj?relaxAutoCommit=true& ...
- unity读取Sqlite数据库
using UnityEngine; using System.Collections; using Mono.Data.Sqlite; using System.Data; public enum ...
- JS中特殊句子-for in
for(var i=0;i<len;i++)这样的用法一般都可以用for in 来替代. 例如: var a = ["a","b","c&quo ...
- J2SE知识点摘记(十七)
1. Applet Applet的生命周期分为四个阶段,各阶段分别由init,start,stop和destroy四种方法来具体体现. public void init() 此方法通知A ...
- Java安全学习
http://blog.csdn.net/wbw1985/article/details/5506515 http://blog.csdn.net/wbw1985/article/details/60 ...
- Office 2010 Toolkit and EZ-Activator
“Office 2010 Toolkit 2.0.1”是“迷你KMS”的更新换代版本.虽然是单一可执行程序,但一身承担两大职能:“KMS服务器”和“客户激活端”.“Office 2010 Toolki ...