Skip to content

Commit 67a10bf

Browse files
authored
Rollup merge of #119656 - RalfJung:round-docs, r=Mark-Simulacrum
document rounding behavior of rint/nearbyint for ties It's not possible to change the rounding mode in Rust, so these intrinsics will always behave like `roundeven`.
2 parents 3465215 + 96acaff commit 67a10bf

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

library/core/src/intrinsics.rs

+12-6
Original file line numberDiff line numberDiff line change
@@ -1783,27 +1783,33 @@ extern "rust-intrinsic" {
17831783
#[rustc_nounwind]
17841784
pub fn truncf64(x: f64) -> f64;
17851785

1786-
/// Returns the nearest integer to an `f32`. May raise an inexact floating-point exception
1787-
/// if the argument is not an integer.
1786+
/// Returns the nearest integer to an `f32`. Changing the rounding mode is not possible in Rust,
1787+
/// so this rounds half-way cases to the number with an even least significant digit.
1788+
///
1789+
/// May raise an inexact floating-point exception if the argument is not an integer.
17881790
///
17891791
/// The stabilized version of this intrinsic is
17901792
/// [`f32::round_ties_even`](../../std/primitive.f32.html#method.round_ties_even)
17911793
#[rustc_nounwind]
17921794
pub fn rintf32(x: f32) -> f32;
1793-
/// Returns the nearest integer to an `f64`. May raise an inexact floating-point exception
1794-
/// if the argument is not an integer.
1795+
/// Returns the nearest integer to an `f64`. Changing the rounding mode is not possible in Rust,
1796+
/// so this rounds half-way cases to the number with an even least significant digit.
1797+
///
1798+
/// May raise an inexact floating-point exception if the argument is not an integer.
17951799
///
17961800
/// The stabilized version of this intrinsic is
17971801
/// [`f64::round_ties_even`](../../std/primitive.f64.html#method.round_ties_even)
17981802
#[rustc_nounwind]
17991803
pub fn rintf64(x: f64) -> f64;
18001804

1801-
/// Returns the nearest integer to an `f32`.
1805+
/// Returns the nearest integer to an `f32`. Changing the rounding mode is not possible in Rust,
1806+
/// so this rounds half-way cases to the number with an even least significant digit.
18021807
///
18031808
/// This intrinsic does not have a stable counterpart.
18041809
#[rustc_nounwind]
18051810
pub fn nearbyintf32(x: f32) -> f32;
1806-
/// Returns the nearest integer to an `f64`.
1811+
/// Returns the nearest integer to an `f64`. Changing the rounding mode is not possible in Rust,
1812+
/// so this rounds half-way cases to the number with an even least significant digit.
18071813
///
18081814
/// This intrinsic does not have a stable counterpart.
18091815
#[rustc_nounwind]

0 commit comments

Comments
 (0)