compiler_builtins/math/libm_math/
roundeven.rs1use super::support::{Float, Round};
2
3#[cfg(f16_enabled)]
6#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
7pub fn roundevenf16(x: f16) -> f16 {
8 roundeven_impl(x)
9}
10
11#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
14pub fn roundevenf(x: f32) -> f32 {
15 roundeven_impl(x)
16}
17
18#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
21pub fn roundeven(x: f64) -> f64 {
22 roundeven_impl(x)
23}
24
25#[cfg(f128_enabled)]
28#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
29pub fn roundevenf128(x: f128) -> f128 {
30 roundeven_impl(x)
31}
32
33#[inline]
34pub fn roundeven_impl<F: Float>(x: F) -> F {
35 super::generic::rint_round(x, Round::Nearest).val
36}