Debian Codegraph @

debian/rust-vendor/libm/src/math/arch/wasm32.rs

raw
1 //! Wasm has builtins for simple float operations. Use the unstable `core::arch` intrinsics which
2 //! are significantly faster than soft float operations.
3
4 pub fn ceil(x: f64) -> f64 {
5 core::arch::wasm32::f64_ceil(x)
6 }
7
8 pub fn ceilf(x: f32) -> f32 {
9 core::arch::wasm32::f32_ceil(x)
10 }
11
12 pub fn fabs(x: f64) -> f64 {
13 x.abs()
14 }
15
16 pub fn fabsf(x: f32) -> f32 {
17 x.abs()
18 }
19
20 pub fn floor(x: f64) -> f64 {
21 core::arch::wasm32::f64_floor(x)
22 }
23
24 pub fn floorf(x: f32) -> f32 {
25 core::arch::wasm32::f32_floor(x)
26 }
27
28 pub fn rint(x: f64) -> f64 {
29 core::arch::wasm32::f64_nearest(x)
30 }
31
32 pub fn rintf(x: f32) -> f32 {
33 core::arch::wasm32::f32_nearest(x)
34 }
35
36 pub fn sqrt(x: f64) -> f64 {
37 core::arch::wasm32::f64_sqrt(x)
38 }
39
40 pub fn sqrtf(x: f32) -> f32 {
41 core::arch::wasm32::f32_sqrt(x)
42 }
43
44 pub fn trunc(x: f64) -> f64 {
45 core::arch::wasm32::f64_trunc(x)
46 }
47
48 pub fn truncf(x: f32) -> f32 {
49 core::arch::wasm32::f32_trunc(x)
50 }