Rollup merge of #135661 - tgross35:stabilize-float_next_up_down, r=scottmcm
Stabilize `float_next_up_down` FCP completed at [1]. For `f16` and `f128`, this just removes the gates in comments and doctests. Closes https://github.com/rust-lang/rust/issues/91399 [1]: https://github.com/rust-lang/rust/issues/91399#issuecomment-2598734570
This commit is contained in:
commit
23fb4f22b3
5 changed files with 32 additions and 17 deletions
|
@ -504,7 +504,6 @@ impl f128 {
|
|||
///
|
||||
/// ```rust
|
||||
/// #![feature(f128)]
|
||||
/// #![feature(float_next_up_down)]
|
||||
/// # // FIXME(f16_f128): remove when `eqtf2` is available
|
||||
/// # #[cfg(all(target_arch = "x86_64", target_os = "linux"))] {
|
||||
///
|
||||
|
@ -516,13 +515,15 @@ 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")]
|
||||
// #[unstable(feature = "float_next_up_down", issue = "91399")]
|
||||
pub const fn next_up(self) -> Self {
|
||||
// Some targets violate Rust's assumption of IEEE semantics, e.g. by flushing
|
||||
// denormals to zero. This is in general unsound and unsupported, but here
|
||||
|
@ -558,7 +559,6 @@ impl f128 {
|
|||
///
|
||||
/// ```rust
|
||||
/// #![feature(f128)]
|
||||
/// #![feature(float_next_up_down)]
|
||||
/// # // FIXME(f16_f128): remove when `eqtf2` is available
|
||||
/// # #[cfg(all(target_arch = "x86_64", target_os = "linux"))] {
|
||||
///
|
||||
|
@ -570,13 +570,15 @@ 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")]
|
||||
// #[unstable(feature = "float_next_up_down", issue = "91399")]
|
||||
pub const fn next_down(self) -> Self {
|
||||
// Some targets violate Rust's assumption of IEEE semantics, e.g. by flushing
|
||||
// denormals to zero. This is in general unsound and unsupported, but here
|
||||
|
|
|
@ -497,7 +497,6 @@ impl f16 {
|
|||
///
|
||||
/// ```rust
|
||||
/// #![feature(f16)]
|
||||
/// #![feature(float_next_up_down)]
|
||||
/// # // FIXME(f16_f128): ABI issues on MSVC
|
||||
/// # #[cfg(all(target_arch = "x86_64", target_os = "linux"))] {
|
||||
///
|
||||
|
@ -509,13 +508,15 @@ 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")]
|
||||
// #[unstable(feature = "float_next_up_down", issue = "91399")]
|
||||
pub const fn next_up(self) -> Self {
|
||||
// Some targets violate Rust's assumption of IEEE semantics, e.g. by flushing
|
||||
// denormals to zero. This is in general unsound and unsupported, but here
|
||||
|
@ -551,7 +552,6 @@ impl f16 {
|
|||
///
|
||||
/// ```rust
|
||||
/// #![feature(f16)]
|
||||
/// #![feature(float_next_up_down)]
|
||||
/// # // FIXME(f16_f128): ABI issues on MSVC
|
||||
/// # #[cfg(all(target_arch = "x86_64", target_os = "linux"))] {
|
||||
///
|
||||
|
@ -563,13 +563,15 @@ 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")]
|
||||
// #[unstable(feature = "float_next_up_down", issue = "91399")]
|
||||
pub const fn next_down(self) -> Self {
|
||||
// Some targets violate Rust's assumption of IEEE semantics, e.g. by flushing
|
||||
// denormals to zero. This is in general unsound and unsupported, but here
|
||||
|
|
|
@ -726,7 +726,6 @@ impl f32 {
|
|||
/// is finite `x == x.next_up().next_down()` also holds.
|
||||
///
|
||||
/// ```rust
|
||||
/// #![feature(float_next_up_down)]
|
||||
/// // f32::EPSILON is the difference between 1.0 and the next number up.
|
||||
/// assert_eq!(1.0f32.next_up(), 1.0 + f32::EPSILON);
|
||||
/// // But not for most numbers.
|
||||
|
@ -734,12 +733,16 @@ 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]
|
||||
#[unstable(feature = "float_next_up_down", issue = "91399")]
|
||||
#[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 {
|
||||
// Some targets violate Rust's assumption of IEEE semantics, e.g. by flushing
|
||||
// denormals to zero. This is in general unsound and unsupported, but here
|
||||
|
@ -774,7 +777,6 @@ impl f32 {
|
|||
/// is finite `x == x.next_down().next_up()` also holds.
|
||||
///
|
||||
/// ```rust
|
||||
/// #![feature(float_next_up_down)]
|
||||
/// let x = 1.0f32;
|
||||
/// // Clamp value into range [0, 1).
|
||||
/// let clamped = x.clamp(0.0, 1.0f32.next_down());
|
||||
|
@ -782,12 +784,16 @@ 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]
|
||||
#[unstable(feature = "float_next_up_down", issue = "91399")]
|
||||
#[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 {
|
||||
// Some targets violate Rust's assumption of IEEE semantics, e.g. by flushing
|
||||
// denormals to zero. This is in general unsound and unsupported, but here
|
||||
|
|
|
@ -743,7 +743,6 @@ impl f64 {
|
|||
/// is finite `x == x.next_up().next_down()` also holds.
|
||||
///
|
||||
/// ```rust
|
||||
/// #![feature(float_next_up_down)]
|
||||
/// // f64::EPSILON is the difference between 1.0 and the next number up.
|
||||
/// assert_eq!(1.0f64.next_up(), 1.0 + f64::EPSILON);
|
||||
/// // But not for most numbers.
|
||||
|
@ -751,12 +750,16 @@ 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]
|
||||
#[unstable(feature = "float_next_up_down", issue = "91399")]
|
||||
#[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 {
|
||||
// Some targets violate Rust's assumption of IEEE semantics, e.g. by flushing
|
||||
// denormals to zero. This is in general unsound and unsupported, but here
|
||||
|
@ -791,7 +794,6 @@ impl f64 {
|
|||
/// is finite `x == x.next_down().next_up()` also holds.
|
||||
///
|
||||
/// ```rust
|
||||
/// #![feature(float_next_up_down)]
|
||||
/// let x = 1.0f64;
|
||||
/// // Clamp value into range [0, 1).
|
||||
/// let clamped = x.clamp(0.0, 1.0f64.next_down());
|
||||
|
@ -799,12 +801,16 @@ 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]
|
||||
#[unstable(feature = "float_next_up_down", issue = "91399")]
|
||||
#[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 {
|
||||
// Some targets violate Rust's assumption of IEEE semantics, e.g. by flushing
|
||||
// denormals to zero. This is in general unsound and unsupported, but here
|
||||
|
|
|
@ -333,7 +333,6 @@
|
|||
#![feature(extend_one)]
|
||||
#![feature(float_gamma)]
|
||||
#![feature(float_minimum_maximum)]
|
||||
#![feature(float_next_up_down)]
|
||||
#![feature(fmt_internals)]
|
||||
#![feature(hasher_prefixfree_extras)]
|
||||
#![feature(hashmap_internals)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue