1 | module math |
2 | |
3 | fn JS.Math.ceil(x f64) f64 |
4 | |
5 | fn JS.Math.floor(x f64) f64 |
6 | |
7 | fn JS.Math.round(x f64) f64 |
8 | |
9 | fn JS.Math.trunc(x f64) f64 |
10 | |
11 | // ceil returns the nearest f64 greater or equal to the provided value. |
12 | [inline] |
13 | pub fn ceil(x f64) f64 { |
14 | return JS.Math.ceil(x) |
15 | } |
16 | |
17 | // floor returns the nearest f64 lower or equal of the provided value. |
18 | [inline] |
19 | pub fn floor(x f64) f64 { |
20 | return JS.Math.floor(x) |
21 | } |
22 | |
23 | // round returns the integer nearest to the provided value. |
24 | [inline] |
25 | pub fn round(x f64) f64 { |
26 | return JS.Math.round(x) |
27 | } |
28 | |
29 | // trunc rounds a toward zero, returning the nearest integral value that is not |
30 | // larger in magnitude than a. |
31 | [inline] |
32 | pub fn trunc(x f64) f64 { |
33 | return JS.Math.trunc(x) |
34 | } |