Skip to content

Commit 584b636

Browse files
authored
simd: Round with round_ties_even (#581)
So that the behaviour matches the SIMD implementation.
1 parent 974bc99 commit 584b636

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

simd/src/scalar/mod.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -119,13 +119,13 @@ impl F32x2 {
119119
/// Converts these packed floats to integers via rounding.
120120
#[inline]
121121
pub fn to_i32x2(self) -> I32x2 {
122-
I32x2([self[0].round() as i32, self[1].round() as i32])
122+
I32x2([self[0].round_ties_even() as i32, self[1].round_ties_even() as i32])
123123
}
124124

125125
/// Converts these packed floats to integers via rounding.
126126
#[inline]
127127
pub fn to_i32x4(self) -> I32x4 {
128-
I32x4([self[0].round() as i32, self[1].round() as i32, 0, 0])
128+
I32x4([self[0].round_ties_even() as i32, self[1].round_ties_even() as i32, 0, 0])
129129
}
130130

131131
// Swizzle
@@ -319,10 +319,10 @@ impl F32x4 {
319319
#[inline]
320320
pub fn to_i32x4(self) -> I32x4 {
321321
I32x4([
322-
self[0].round() as i32,
323-
self[1].round() as i32,
324-
self[2].round() as i32,
325-
self[3].round() as i32,
322+
self[0].round_ties_even() as i32,
323+
self[1].round_ties_even() as i32,
324+
self[2].round_ties_even() as i32,
325+
self[3].round_ties_even() as i32,
326326
])
327327
}
328328

0 commit comments

Comments
 (0)