File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed
Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ local x = 0 / 0
1010print(x ~= x) -- Lua way: Prove the variable is NaN because it is not equal to itself. Works, but unintuitive.
1111print(math.isnan(x))
1212```
13+
1314---
1415### ` math.round `
1516Rounds a number to the nearest integer.
@@ -19,6 +20,37 @@ Rounds a number to the nearest integer.
1920print(math.round(2.4)) --> 2
2021print(math.round(2.5)) --> 3
2122```
23+
24+ ---
25+ ### ` math.trunc `
26+ Truncates the fractional part of a number, returning the integer portion toward zero.
27+ #### Parameters
28+ 1 . The number to truncate.
29+ ``` pluto
30+ print(math.trunc(10.5)) --> 10
31+ print(math.trunc(-10.5)) --> -10
32+ ```
33+
34+ ---
35+ ### ` math.cbrt `
36+ Returns the cube root of a number.
37+ #### Parameters
38+ 1 . The number to take the cube root of.
39+ ``` pluto
40+ print(math.cbrt(27)) --> 3
41+ print(math.cbrt(-27)) --> -3
42+ ```
43+
44+ ---
45+ ### ` math.hypot `
46+ Returns the square root of the sum of squares of its arguments.
47+ #### Parameters
48+ 1 . Two numbers representing orthogonal components.
49+ ``` pluto
50+ print(math.hypot(3, 4)) --> 5
51+ print(math.hypot(1e155, 1e155)) --> 1.41421e155
52+ ```
53+
2254---
2355### ` math.atan2 `
2456An alias for the ` math.atan ` function.
You can’t perform that action at this time.
0 commit comments