1#[cfg(f16_enabled)]
5#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
6pub fn truncf16(x: f16) -> f16 {
7    super::generic::trunc(x)
8}
9
10#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
14pub fn truncf(x: f32) -> f32 {
15    select_implementation! {
16        name: truncf,
17        use_arch: all(target_arch = "wasm32", intrinsics_enabled),
18        args: x,
19    }
20
21    super::generic::trunc(x)
22}
23
24#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
28pub fn trunc(x: f64) -> f64 {
29    select_implementation! {
30        name: trunc,
31        use_arch: all(target_arch = "wasm32", intrinsics_enabled),
32        args: x,
33    }
34
35    super::generic::trunc(x)
36}
37
38#[cfg(f128_enabled)]
42#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
43pub fn truncf128(x: f128) -> f128 {
44    super::generic::trunc(x)
45}
46
47#[cfg(test)]
48mod tests {
49    #[test]
50    fn sanity_check() {
51        assert_eq!(super::truncf(1.1), 1.0);
52    }
53}