/rust/registry/src/index.crates.io-1949cf8c6b5b557f/libm-0.2.16/src/math/roundeven.rs
Line | Count | Source |
1 | | use super::support::{Float, Round}; |
2 | | |
3 | | /// Round `x` to the nearest integer, breaking ties toward even. This is IEEE 754 |
4 | | /// `roundToIntegralTiesToEven`. |
5 | | #[cfg(f16_enabled)] |
6 | | #[cfg_attr(assert_no_panic, no_panic::no_panic)] |
7 | | pub fn roundevenf16(x: f16) -> f16 { |
8 | | roundeven_impl(x) |
9 | | } |
10 | | |
11 | | /// Round `x` to the nearest integer, breaking ties toward even. This is IEEE 754 |
12 | | /// `roundToIntegralTiesToEven`. |
13 | | #[cfg_attr(assert_no_panic, no_panic::no_panic)] |
14 | 0 | pub fn roundevenf(x: f32) -> f32 { |
15 | 0 | roundeven_impl(x) |
16 | 0 | } |
17 | | |
18 | | /// Round `x` to the nearest integer, breaking ties toward even. This is IEEE 754 |
19 | | /// `roundToIntegralTiesToEven`. |
20 | | #[cfg_attr(assert_no_panic, no_panic::no_panic)] |
21 | 0 | pub fn roundeven(x: f64) -> f64 { |
22 | 0 | roundeven_impl(x) |
23 | 0 | } |
24 | | |
25 | | /// Round `x` to the nearest integer, breaking ties toward even. This is IEEE 754 |
26 | | /// `roundToIntegralTiesToEven`. |
27 | | #[cfg(f128_enabled)] |
28 | | #[cfg_attr(assert_no_panic, no_panic::no_panic)] |
29 | | pub fn roundevenf128(x: f128) -> f128 { |
30 | | roundeven_impl(x) |
31 | | } |
32 | | |
33 | | #[inline] |
34 | 0 | pub fn roundeven_impl<F: Float>(x: F) -> F { |
35 | 0 | super::generic::rint_round(x, Round::Nearest).val |
36 | 0 | } Unexecuted instantiation: libm::math::roundeven::roundeven_impl::<f64> Unexecuted instantiation: libm::math::roundeven::roundeven_impl::<f32> |