This article introduces all the functions of the LUA Math Library, this article lists all the functions of the LUA Math library, and gives a brief description of the functional function of each function, and the friends you need can refer to the
Math.PI is PI constant = 3.14159265358979323846
Abs |
Take absolute value |
Math.Abs (-15) |
15 |
ACOs |
Inverse cosine function |
Math.acos (0.5) |
1.04719755 |
Asin |
Inverse chord function |
Math.asin (0.5) |
0.52359877 |
Atan2 |
x/y tangent value of the inverse |
Math.atan2 (90.0, 45.0) |
1.10714871 |
Atan |
Inverse tangent function |
Math.atan (0.5) |
0.463647609 |
Ceil |
The largest integer not less than X |
Math.ceil (5.8) |
6 |
Cosh |
cosine function of hyperbolic curve |
Math.cosh (0.5) |
1.276259652 |
Cos |
cosine function |
Math.Cos (0.5) |
0.87758256 |
Deg |
radians Turn angle |
Math.deg (Math.PI) |
180 |
Exp |
Calculates an e as the base X-Second square value |
Math.exp (2) |
2.718281828 |
Floor |
The largest integer not greater than X |
Math.floor (5.6) |
5 |
Fmod (MoD) |
Modulo operation |
Math.mod (14, 5) |
4 |
Frexp |
Divide the double-precision number Val into the digital part (MANTISSA) and the 2-based exponent n, i.e. val=x*2n |
MATH.FREXP (10.0) |
0.625 4 |
Ldexp |
Computes the N-second side of value * 2 |
Math.ldexp (10.0, 3) |
80 = 10 * (2 ^3) |
Log10 |
Computes the logarithm with a base of 10 |
MATH.LOG10 (100) |
2 |
Log |
Calculates the natural logarithm of a number |
Math.log (2.71) |
0.9969 |
Max |
Get maximum value in parameter |
Math.max (2.71, 100,-98, 23) |
100 |
Min |
Get the minimum value in the parameter |
Math.min (2.71, 100,-98, 23) |
-98 |
Modf |
Divide the number into integers and decimals |
MATH.MODF (15.98) |
15 98 |
Pow |
Get the Y-side of X |
Math.pow (2, 5) |
32 |
Rad |
Angle Turn radians |
Math.rad (180) |
3.14159265358 |
Random |
Get random numbers |
Math.random (1, 100) Math.random (100) |
Get 1-100 of random numbers |
Randomseed |
Set random number of seeds |
Math.randomseed (Os.time ()) |
You must use this function to set the random number seed before using the Math.random function |
Sinh |
sine function of hyperbolic curve |
Math.sinh (0.5) |
0.5210953 |
Sin |
sine function |
Math.sin (Math.rad (30)) |
0.5 |
sqrt |
Open Square function |
MATH.SQRT (16) |
4 |
Tanh |
Hyperbola tangent function |
Math.tanh (0.5) |
0.46211715 |
Tan |
Tangent function |
Math.tan (0.5) |
0.5463024 |