about summary refs log tree commit diff
path: root/library/std/src
diff options
context:
space:
mode:
authorJules Bertholet <julesbertholet@quoi.xyz>2022-11-07 13:10:36 -0500
committerJules Bertholet <julesbertholet@quoi.xyz>2022-12-11 01:20:18 -0500
commitf8138110bca50f8eb9196e098d20df5f496b7051 (patch)
treef2bfbad05c4f55121c41413829efbb3baff6ac53 /library/std/src
parent03c166d3893aba971beecaf65d0722f44a786ecf (diff)
downloadrust-f8138110bca50f8eb9196e098d20df5f496b7051.tar.gz
rust-f8138110bca50f8eb9196e098d20df5f496b7051.zip
Use rint instead of roundeven
Use rint intrinsic instead of roundeven to impement `round_ties_even`. They do the same thing when rounding mode is default, which Rust assumes.
And `rint` has better platform support.

Keeps `roundeven` around in `core::intrinsics`, it's doing no harm there.
Diffstat (limited to 'library/std/src')
-rw-r--r--library/std/src/f32.rs2
-rw-r--r--library/std/src/f64.rs2
2 files changed, 2 insertions, 2 deletions
diff --git a/library/std/src/f32.rs b/library/std/src/f32.rs
index d92eb45e96c..221ad469de9 100644
--- a/library/std/src/f32.rs
+++ b/library/std/src/f32.rs
@@ -119,7 +119,7 @@ impl f32 {
     #[unstable(feature = "round_ties_even", issue = "96710")]
     #[inline]
     pub fn round_ties_even(self) -> f32 {
-        unsafe { intrinsics::roundevenf32(self) }
+        unsafe { intrinsics::rintf32(self) }
     }
 
     /// Returns the integer part of `self`.
diff --git a/library/std/src/f64.rs b/library/std/src/f64.rs
index 2e98495fad3..4663e00f9ed 100644
--- a/library/std/src/f64.rs
+++ b/library/std/src/f64.rs
@@ -119,7 +119,7 @@ impl f64 {
     #[unstable(feature = "round_ties_even", issue = "96710")]
     #[inline]
     pub fn round_ties_even(self) -> f64 {
-        unsafe { intrinsics::roundevenf64(self) }
+        unsafe { intrinsics::rintf64(self) }
     }
 
     /// Returns the integer part of `self`.