LUA Math Library

Source: Internet
Author: User
Tags acos asin lua natural logarithm

Atan2, Sinh, cosh, Tanh 4 should not be used.

Name of function Describe Example Results
Pi Pi Math.PI 3.1415926535898
Abs Take absolute value Math.Abs (-2012) 2012
Ceil Rounding up Math.ceil (9.1) 10
Floor Rounding down Math.floor (9.9) 9
Max Take parameter Maximum value Math.max (2,4,6,8) 8
Min Take the minimum value of the parameter Math.min (2,4,6,8) 2
Pow Calculates the y power of X Math.pow (2,16) 65536
sqrt Open Square MATH.SQRT (65536) 256
MoD Take the mold Math.mod (65535,2) 1
Modf Taking integers and fractional parts MATH.MODF (20.12) 20 0.12
Randomseed Set random number Seed Math.randomseed (Os.time ())  
Random Take a random number Math.random (5,90) 5~90
Rad Angle to radians Math.rad (180) 3.1415926535898
Deg Radian to Angle Math.deg (Math.PI) 180
Exp E's X-square Math.exp (4) 54.598150033144
Log Calculates the natural logarithm of X Math.log (54.598150033144) 4
Log10 Calculates the logarithm of 10 for the base and X MATH.LOG10 (1000) 3
Frexp Splits the parameter into the form x * (2 ^ y) Math.frexp (160) 0.625 8
Ldexp Calculate x * (2 ^ y) Math.ldexp (0.625,8) 160
Sin Sinusoidal Math.sin (Math.rad (30)) 0.5
Cos Cosine Math.Cos (Math.rad (60)) 0.5
Tan Tangent Math.tan (Math.rad (45)) 1
Asin Anyway chord Math.deg (Math.asin (0.5)) 30
ACOs Inverse cosine Math.deg (Math.acos (0.5)) 60
Atan Anyway cut Math.deg (Math.atan (1)) 45

LUA Math Library

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.