Skip to content

Commit

Permalink
Add references to the IEEE functions for float_next_up_down
Browse files Browse the repository at this point in the history
Mention the IEEE function by name and create a doc alias of the same.
  • Loading branch information
tgross35 committed Jan 17, 2025
1 parent 366ceca commit 809f61a
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 0 deletions.
6 changes: 6 additions & 0 deletions library/core/src/num/f128.rs
Original file line number Diff line number Diff line change
Expand Up @@ -515,11 +515,14 @@ impl f128 {
/// # }
/// ```
///
/// This operation corresponds to IEEE-754 `nextUp`.
///
/// [`NEG_INFINITY`]: Self::NEG_INFINITY
/// [`INFINITY`]: Self::INFINITY
/// [`MIN`]: Self::MIN
/// [`MAX`]: Self::MAX
#[inline]
#[doc(alias = "nextUp")]
#[unstable(feature = "f128", issue = "116909")]
pub const fn next_up(self) -> Self {
// Some targets violate Rust's assumption of IEEE semantics, e.g. by flushing
Expand Down Expand Up @@ -567,11 +570,14 @@ impl f128 {
/// # }
/// ```
///
/// This operation corresponds to IEEE-754 `nextDown`.
///
/// [`NEG_INFINITY`]: Self::NEG_INFINITY
/// [`INFINITY`]: Self::INFINITY
/// [`MIN`]: Self::MIN
/// [`MAX`]: Self::MAX
#[inline]
#[doc(alias = "nextDown")]
#[unstable(feature = "f128", issue = "116909")]
pub const fn next_down(self) -> Self {
// Some targets violate Rust's assumption of IEEE semantics, e.g. by flushing
Expand Down
6 changes: 6 additions & 0 deletions library/core/src/num/f16.rs
Original file line number Diff line number Diff line change
Expand Up @@ -508,11 +508,14 @@ impl f16 {
/// # }
/// ```
///
/// This operation corresponds to IEEE-754 `nextUp`.
///
/// [`NEG_INFINITY`]: Self::NEG_INFINITY
/// [`INFINITY`]: Self::INFINITY
/// [`MIN`]: Self::MIN
/// [`MAX`]: Self::MAX
#[inline]
#[doc(alias = "nextUp")]
#[unstable(feature = "f16", issue = "116909")]
pub const fn next_up(self) -> Self {
// Some targets violate Rust's assumption of IEEE semantics, e.g. by flushing
Expand Down Expand Up @@ -560,11 +563,14 @@ impl f16 {
/// # }
/// ```
///
/// This operation corresponds to IEEE-754 `nextDown`.
///
/// [`NEG_INFINITY`]: Self::NEG_INFINITY
/// [`INFINITY`]: Self::INFINITY
/// [`MIN`]: Self::MIN
/// [`MAX`]: Self::MAX
#[inline]
#[doc(alias = "nextDown")]
#[unstable(feature = "f16", issue = "116909")]
pub const fn next_down(self) -> Self {
// Some targets violate Rust's assumption of IEEE semantics, e.g. by flushing
Expand Down
6 changes: 6 additions & 0 deletions library/core/src/num/f32.rs
Original file line number Diff line number Diff line change
Expand Up @@ -733,11 +733,14 @@ impl f32 {
/// assert_eq!(16777216f32.next_up(), 16777218.0);
/// ```
///
/// This operation corresponds to IEEE-754 `nextUp`.
///
/// [`NEG_INFINITY`]: Self::NEG_INFINITY
/// [`INFINITY`]: Self::INFINITY
/// [`MIN`]: Self::MIN
/// [`MAX`]: Self::MAX
#[inline]
#[doc(alias = "nextUp")]
#[stable(feature = "float_next_up_down", since = "CURRENT_RUSTC_VERSION")]
#[rustc_const_stable(feature = "float_next_up_down", since = "CURRENT_RUSTC_VERSION")]
pub const fn next_up(self) -> Self {
Expand Down Expand Up @@ -781,11 +784,14 @@ impl f32 {
/// assert_eq!(clamped.next_up(), 1.0);
/// ```
///
/// This operation corresponds to IEEE-754 `nextDown`.
///
/// [`NEG_INFINITY`]: Self::NEG_INFINITY
/// [`INFINITY`]: Self::INFINITY
/// [`MIN`]: Self::MIN
/// [`MAX`]: Self::MAX
#[inline]
#[doc(alias = "nextDown")]
#[stable(feature = "float_next_up_down", since = "CURRENT_RUSTC_VERSION")]
#[rustc_const_stable(feature = "float_next_up_down", since = "CURRENT_RUSTC_VERSION")]
pub const fn next_down(self) -> Self {
Expand Down
6 changes: 6 additions & 0 deletions library/core/src/num/f64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -750,11 +750,14 @@ impl f64 {
/// assert_eq!(9007199254740992f64.next_up(), 9007199254740994.0);
/// ```
///
/// This operation corresponds to IEEE-754 `nextUp`.
///
/// [`NEG_INFINITY`]: Self::NEG_INFINITY
/// [`INFINITY`]: Self::INFINITY
/// [`MIN`]: Self::MIN
/// [`MAX`]: Self::MAX
#[inline]
#[doc(alias = "nextUp")]
#[stable(feature = "float_next_up_down", since = "CURRENT_RUSTC_VERSION")]
#[rustc_const_stable(feature = "float_next_up_down", since = "CURRENT_RUSTC_VERSION")]
pub const fn next_up(self) -> Self {
Expand Down Expand Up @@ -798,11 +801,14 @@ impl f64 {
/// assert_eq!(clamped.next_up(), 1.0);
/// ```
///
/// This operation corresponds to IEEE-754 `nextDown`.
///
/// [`NEG_INFINITY`]: Self::NEG_INFINITY
/// [`INFINITY`]: Self::INFINITY
/// [`MIN`]: Self::MIN
/// [`MAX`]: Self::MAX
#[inline]
#[doc(alias = "nextDown")]
#[stable(feature = "float_next_up_down", since = "CURRENT_RUSTC_VERSION")]
#[rustc_const_stable(feature = "float_next_up_down", since = "CURRENT_RUSTC_VERSION")]
pub const fn next_down(self) -> Self {
Expand Down

0 comments on commit 809f61a

Please sign in to comment.