From ab8e9504892dd7f893d9f55a4a6f78f12bf20891 Mon Sep 17 00:00:00 2001 From: Wesley Moore Date: Wed, 2 Jul 2025 14:03:31 +1000 Subject: [PATCH] simd: Round with round_ties_even So that the behaviour matches the SIMD implementation. --- simd/src/scalar/mod.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/simd/src/scalar/mod.rs b/simd/src/scalar/mod.rs index 601d70d0f..c9ae2f676 100644 --- a/simd/src/scalar/mod.rs +++ b/simd/src/scalar/mod.rs @@ -119,13 +119,13 @@ impl F32x2 { /// Converts these packed floats to integers via rounding. #[inline] pub fn to_i32x2(self) -> I32x2 { - I32x2([self[0].round() as i32, self[1].round() as i32]) + I32x2([self[0].round_ties_even() as i32, self[1].round_ties_even() as i32]) } /// Converts these packed floats to integers via rounding. #[inline] pub fn to_i32x4(self) -> I32x4 { - I32x4([self[0].round() as i32, self[1].round() as i32, 0, 0]) + I32x4([self[0].round_ties_even() as i32, self[1].round_ties_even() as i32, 0, 0]) } // Swizzle @@ -319,10 +319,10 @@ impl F32x4 { #[inline] pub fn to_i32x4(self) -> I32x4 { I32x4([ - self[0].round() as i32, - self[1].round() as i32, - self[2].round() as i32, - self[3].round() as i32, + self[0].round_ties_even() as i32, + self[1].round_ties_even() as i32, + self[2].round_ties_even() as i32, + self[3].round_ties_even() as i32, ]) }