1use super::support::Round;
2
3/// Round `x` to the nearest integer, breaking ties toward even.
4#[cfg(f16_enabled)]
5#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
6pub fn rintf16(x: f16) -> f16 {
7 super::generic::rint_round(x, Round::Nearest).val
8}
9
10/// Round `x` to the nearest integer, breaking ties toward even.
11#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
12pub fn rintf(x: f32) -> f32 {
13 select_implementation! {
14 name: rintf,
15 use_arch: any(
16 all(target_arch = "wasm32", intrinsics_enabled),
17 all(target_arch = "aarch64", target_feature = "neon", target_endian = "little"),
18 ),
19 args: x,
20 }
21
22 super::generic::rint_round(x, Round::Nearest).val
23}
24
25/// Round `x` to the nearest integer, breaking ties toward even.
26#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
27pub fn rint(x: f64) -> f64 {
28 select_implementation! {
29 name: rint,
30 use_arch: any(
31 all(target_arch = "wasm32", intrinsics_enabled),
32 all(target_arch = "aarch64", target_feature = "neon", target_endian = "little"),
33 ),
34 args: x,
35 }
36
37 super::generic::rint_round(x, Round::Nearest).val
38}
39
40/// Round `x` to the nearest integer, breaking ties toward even.
41#[cfg(f128_enabled)]
42#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
43pub fn rintf128(x: f128) -> f128 {
44 super::generic::rint_round(x, Round::Nearest).val
45}
46