diff options
Diffstat (limited to 'library/std/src/f16.rs')
| -rw-r--r-- | library/std/src/f16.rs | 608 |
1 files changed, 66 insertions, 542 deletions
diff --git a/library/std/src/f16.rs b/library/std/src/f16.rs index 3f88ab2d400..4792eac1f9e 100644 --- a/library/std/src/f16.rs +++ b/library/std/src/f16.rs @@ -14,375 +14,6 @@ use crate::sys::cmath; #[cfg(not(test))] impl f16 { - /// Returns the largest integer less than or equal to `self`. - /// - /// This function always returns the precise result. - /// - /// # Examples - /// - /// ``` - /// #![feature(f16)] - /// # #![cfg_attr(not(bootstrap), feature(cfg_target_has_reliable_f16_f128))] - /// # #![cfg_attr(not(bootstrap), expect(internal_features))] - /// # #[cfg(not(miri))] - /// # #[cfg(not(bootstrap))] - /// # #[cfg(target_has_reliable_f16_math)] { - /// - /// let f = 3.7_f16; - /// let g = 3.0_f16; - /// let h = -3.7_f16; - /// - /// assert_eq!(f.floor(), 3.0); - /// assert_eq!(g.floor(), 3.0); - /// assert_eq!(h.floor(), -4.0); - /// # } - /// ``` - #[inline] - #[rustc_allow_incoherent_impl] - #[unstable(feature = "f16", issue = "116909")] - #[must_use = "method returns a new number and does not mutate the original value"] - pub fn floor(self) -> f16 { - unsafe { intrinsics::floorf16(self) } - } - - /// Returns the smallest integer greater than or equal to `self`. - /// - /// This function always returns the precise result. - /// - /// # Examples - /// - /// ``` - /// #![feature(f16)] - /// # #![cfg_attr(not(bootstrap), feature(cfg_target_has_reliable_f16_f128))] - /// # #![cfg_attr(not(bootstrap), expect(internal_features))] - /// # #[cfg(not(miri))] - /// # #[cfg(not(bootstrap))] - /// # #[cfg(target_has_reliable_f16_math)] { - /// - /// let f = 3.01_f16; - /// let g = 4.0_f16; - /// - /// assert_eq!(f.ceil(), 4.0); - /// assert_eq!(g.ceil(), 4.0); - /// # } - /// ``` - #[inline] - #[doc(alias = "ceiling")] - #[rustc_allow_incoherent_impl] - #[unstable(feature = "f16", issue = "116909")] - #[must_use = "method returns a new number and does not mutate the original value"] - pub fn ceil(self) -> f16 { - unsafe { intrinsics::ceilf16(self) } - } - - /// Returns the nearest integer to `self`. If a value is half-way between two - /// integers, round away from `0.0`. - /// - /// This function always returns the precise result. - /// - /// # Examples - /// - /// ``` - /// #![feature(f16)] - /// # #![cfg_attr(not(bootstrap), feature(cfg_target_has_reliable_f16_f128))] - /// # #![cfg_attr(not(bootstrap), expect(internal_features))] - /// # #[cfg(not(miri))] - /// # #[cfg(not(bootstrap))] - /// # #[cfg(target_has_reliable_f16_math)] { - /// - /// let f = 3.3_f16; - /// let g = -3.3_f16; - /// let h = -3.7_f16; - /// let i = 3.5_f16; - /// let j = 4.5_f16; - /// - /// assert_eq!(f.round(), 3.0); - /// assert_eq!(g.round(), -3.0); - /// assert_eq!(h.round(), -4.0); - /// assert_eq!(i.round(), 4.0); - /// assert_eq!(j.round(), 5.0); - /// # } - /// ``` - #[inline] - #[rustc_allow_incoherent_impl] - #[unstable(feature = "f16", issue = "116909")] - #[must_use = "method returns a new number and does not mutate the original value"] - pub fn round(self) -> f16 { - unsafe { intrinsics::roundf16(self) } - } - - /// Returns the nearest integer to a number. Rounds half-way cases to the number - /// with an even least significant digit. - /// - /// This function always returns the precise result. - /// - /// # Examples - /// - /// ``` - /// #![feature(f16)] - /// # #![cfg_attr(not(bootstrap), feature(cfg_target_has_reliable_f16_f128))] - /// # #![cfg_attr(not(bootstrap), expect(internal_features))] - /// # #[cfg(not(miri))] - /// # #[cfg(not(bootstrap))] - /// # #[cfg(target_has_reliable_f16_math)] { - /// - /// let f = 3.3_f16; - /// let g = -3.3_f16; - /// let h = 3.5_f16; - /// let i = 4.5_f16; - /// - /// assert_eq!(f.round_ties_even(), 3.0); - /// assert_eq!(g.round_ties_even(), -3.0); - /// assert_eq!(h.round_ties_even(), 4.0); - /// assert_eq!(i.round_ties_even(), 4.0); - /// # } - /// ``` - #[inline] - #[rustc_allow_incoherent_impl] - #[unstable(feature = "f16", issue = "116909")] - #[must_use = "method returns a new number and does not mutate the original value"] - pub fn round_ties_even(self) -> f16 { - intrinsics::round_ties_even_f16(self) - } - - /// Returns the integer part of `self`. - /// This means that non-integer numbers are always truncated towards zero. - /// - /// This function always returns the precise result. - /// - /// # Examples - /// - /// ``` - /// #![feature(f16)] - /// # #![cfg_attr(not(bootstrap), feature(cfg_target_has_reliable_f16_f128))] - /// # #![cfg_attr(not(bootstrap), expect(internal_features))] - /// # #[cfg(not(miri))] - /// # #[cfg(not(bootstrap))] - /// # #[cfg(target_has_reliable_f16_math)] { - /// - /// let f = 3.7_f16; - /// let g = 3.0_f16; - /// let h = -3.7_f16; - /// - /// assert_eq!(f.trunc(), 3.0); - /// assert_eq!(g.trunc(), 3.0); - /// assert_eq!(h.trunc(), -3.0); - /// # } - /// ``` - #[inline] - #[doc(alias = "truncate")] - #[rustc_allow_incoherent_impl] - #[unstable(feature = "f16", issue = "116909")] - #[must_use = "method returns a new number and does not mutate the original value"] - pub fn trunc(self) -> f16 { - unsafe { intrinsics::truncf16(self) } - } - - /// Returns the fractional part of `self`. - /// - /// This function always returns the precise result. - /// - /// # Examples - /// - /// ``` - /// #![feature(f16)] - /// # #![cfg_attr(not(bootstrap), feature(cfg_target_has_reliable_f16_f128))] - /// # #![cfg_attr(not(bootstrap), expect(internal_features))] - /// # #[cfg(not(miri))] - /// # #[cfg(not(bootstrap))] - /// # #[cfg(target_has_reliable_f16_math)] { - /// - /// let x = 3.6_f16; - /// let y = -3.6_f16; - /// let abs_difference_x = (x.fract() - 0.6).abs(); - /// let abs_difference_y = (y.fract() - (-0.6)).abs(); - /// - /// assert!(abs_difference_x <= f16::EPSILON); - /// assert!(abs_difference_y <= f16::EPSILON); - /// # } - /// ``` - #[inline] - #[rustc_allow_incoherent_impl] - #[unstable(feature = "f16", issue = "116909")] - #[must_use = "method returns a new number and does not mutate the original value"] - pub fn fract(self) -> f16 { - self - self.trunc() - } - - /// Fused multiply-add. Computes `(self * a) + b` with only one rounding - /// error, yielding a more accurate result than an unfused multiply-add. - /// - /// Using `mul_add` *may* be more performant than an unfused multiply-add if - /// the target architecture has a dedicated `fma` CPU instruction. However, - /// this is not always true, and will be heavily dependant on designing - /// algorithms with specific target hardware in mind. - /// - /// # Precision - /// - /// The result of this operation is guaranteed to be the rounded - /// infinite-precision result. It is specified by IEEE 754 as - /// `fusedMultiplyAdd` and guaranteed not to change. - /// - /// # Examples - /// - /// ``` - /// #![feature(f16)] - /// # #![cfg_attr(not(bootstrap), feature(cfg_target_has_reliable_f16_f128))] - /// # #![cfg_attr(not(bootstrap), expect(internal_features))] - /// # #[cfg(not(miri))] - /// # #[cfg(not(bootstrap))] - /// # #[cfg(target_has_reliable_f16_math)] { - /// - /// let m = 10.0_f16; - /// let x = 4.0_f16; - /// let b = 60.0_f16; - /// - /// assert_eq!(m.mul_add(x, b), 100.0); - /// assert_eq!(m * x + b, 100.0); - /// - /// let one_plus_eps = 1.0_f16 + f16::EPSILON; - /// let one_minus_eps = 1.0_f16 - f16::EPSILON; - /// let minus_one = -1.0_f16; - /// - /// // The exact result (1 + eps) * (1 - eps) = 1 - eps * eps. - /// assert_eq!(one_plus_eps.mul_add(one_minus_eps, minus_one), -f16::EPSILON * f16::EPSILON); - /// // Different rounding with the non-fused multiply and add. - /// assert_eq!(one_plus_eps * one_minus_eps + minus_one, 0.0); - /// # } - /// ``` - #[inline] - #[rustc_allow_incoherent_impl] - #[unstable(feature = "f16", issue = "116909")] - #[doc(alias = "fmaf16", alias = "fusedMultiplyAdd")] - #[must_use = "method returns a new number and does not mutate the original value"] - pub fn mul_add(self, a: f16, b: f16) -> f16 { - unsafe { intrinsics::fmaf16(self, a, b) } - } - - /// Calculates Euclidean division, the matching method for `rem_euclid`. - /// - /// This computes the integer `n` such that - /// `self = n * rhs + self.rem_euclid(rhs)`. - /// In other words, the result is `self / rhs` rounded to the integer `n` - /// such that `self >= n * rhs`. - /// - /// # Precision - /// - /// The result of this operation is guaranteed to be the rounded - /// infinite-precision result. - /// - /// # Examples - /// - /// ``` - /// #![feature(f16)] - /// # #![cfg_attr(not(bootstrap), feature(cfg_target_has_reliable_f16_f128))] - /// # #![cfg_attr(not(bootstrap), expect(internal_features))] - /// # #[cfg(not(miri))] - /// # #[cfg(not(bootstrap))] - /// # #[cfg(target_has_reliable_f16_math)] { - /// - /// let a: f16 = 7.0; - /// let b = 4.0; - /// assert_eq!(a.div_euclid(b), 1.0); // 7.0 > 4.0 * 1.0 - /// assert_eq!((-a).div_euclid(b), -2.0); // -7.0 >= 4.0 * -2.0 - /// assert_eq!(a.div_euclid(-b), -1.0); // 7.0 >= -4.0 * -1.0 - /// assert_eq!((-a).div_euclid(-b), 2.0); // -7.0 >= -4.0 * 2.0 - /// # } - /// ``` - #[inline] - #[rustc_allow_incoherent_impl] - #[unstable(feature = "f16", issue = "116909")] - #[must_use = "method returns a new number and does not mutate the original value"] - pub fn div_euclid(self, rhs: f16) -> f16 { - let q = (self / rhs).trunc(); - if self % rhs < 0.0 { - return if rhs > 0.0 { q - 1.0 } else { q + 1.0 }; - } - q - } - - /// Calculates the least nonnegative remainder of `self (mod rhs)`. - /// - /// In particular, the return value `r` satisfies `0.0 <= r < rhs.abs()` in - /// most cases. However, due to a floating point round-off error it can - /// result in `r == rhs.abs()`, violating the mathematical definition, if - /// `self` is much smaller than `rhs.abs()` in magnitude and `self < 0.0`. - /// This result is not an element of the function's codomain, but it is the - /// closest floating point number in the real numbers and thus fulfills the - /// property `self == self.div_euclid(rhs) * rhs + self.rem_euclid(rhs)` - /// approximately. - /// - /// # Precision - /// - /// The result of this operation is guaranteed to be the rounded - /// infinite-precision result. - /// - /// # Examples - /// - /// ``` - /// #![feature(f16)] - /// # #![cfg_attr(not(bootstrap), feature(cfg_target_has_reliable_f16_f128))] - /// # #![cfg_attr(not(bootstrap), expect(internal_features))] - /// # #[cfg(not(miri))] - /// # #[cfg(not(bootstrap))] - /// # #[cfg(target_has_reliable_f16_math)] { - /// - /// let a: f16 = 7.0; - /// let b = 4.0; - /// assert_eq!(a.rem_euclid(b), 3.0); - /// assert_eq!((-a).rem_euclid(b), 1.0); - /// assert_eq!(a.rem_euclid(-b), 3.0); - /// assert_eq!((-a).rem_euclid(-b), 1.0); - /// // limitation due to round-off error - /// assert!((-f16::EPSILON).rem_euclid(3.0) != 0.0); - /// # } - /// ``` - #[inline] - #[rustc_allow_incoherent_impl] - #[doc(alias = "modulo", alias = "mod")] - #[unstable(feature = "f16", issue = "116909")] - #[must_use = "method returns a new number and does not mutate the original value"] - pub fn rem_euclid(self, rhs: f16) -> f16 { - let r = self % rhs; - if r < 0.0 { r + rhs.abs() } else { r } - } - - /// Raises a number to an integer power. - /// - /// Using this function is generally faster than using `powf`. - /// It might have a different sequence of rounding operations than `powf`, - /// so the results are not guaranteed to agree. - /// - /// # Unspecified precision - /// - /// The precision of this function is non-deterministic. This means it varies by platform, - /// Rust version, and can even differ within the same execution from one invocation to the next. - /// - /// # Examples - /// - /// ``` - /// #![feature(f16)] - /// # #![cfg_attr(not(bootstrap), feature(cfg_target_has_reliable_f16_f128))] - /// # #![cfg_attr(not(bootstrap), expect(internal_features))] - /// # #[cfg(not(miri))] - /// # #[cfg(not(bootstrap))] - /// # #[cfg(target_has_reliable_f16_math)] { - /// - /// let x = 2.0_f16; - /// let abs_difference = (x.powi(2) - (x * x)).abs(); - /// assert!(abs_difference <= f16::EPSILON); - /// - /// assert_eq!(f16::powi(f16::NAN, 0), 1.0); - /// # } - /// ``` - #[inline] - #[rustc_allow_incoherent_impl] - #[unstable(feature = "f16", issue = "116909")] - #[must_use = "method returns a new number and does not mutate the original value"] - pub fn powi(self, n: i32) -> f16 { - unsafe { intrinsics::powif16(self, n) } - } - /// Raises a number to a floating point power. /// /// # Unspecified precision @@ -394,10 +25,9 @@ impl f16 { /// /// ``` /// #![feature(f16)] - /// # #![cfg_attr(not(bootstrap), feature(cfg_target_has_reliable_f16_f128))] - /// # #![cfg_attr(not(bootstrap), expect(internal_features))] + /// # #![feature(cfg_target_has_reliable_f16_f128)] + /// # #![expect(internal_features)] /// # #[cfg(not(miri))] - /// # #[cfg(not(bootstrap))] /// # #[cfg(target_has_reliable_f16_math)] { /// /// let x = 2.0_f16; @@ -416,44 +46,6 @@ impl f16 { unsafe { intrinsics::powf16(self, n) } } - /// Returns the square root of a number. - /// - /// Returns NaN if `self` is a negative number other than `-0.0`. - /// - /// # Precision - /// - /// The result of this operation is guaranteed to be the rounded - /// infinite-precision result. It is specified by IEEE 754 as `squareRoot` - /// and guaranteed not to change. - /// - /// # Examples - /// - /// ``` - /// #![feature(f16)] - /// # #![cfg_attr(not(bootstrap), feature(cfg_target_has_reliable_f16_f128))] - /// # #![cfg_attr(not(bootstrap), expect(internal_features))] - /// # #[cfg(not(miri))] - /// # #[cfg(not(bootstrap))] - /// # #[cfg(target_has_reliable_f16_math)] { - /// - /// let positive = 4.0_f16; - /// let negative = -4.0_f16; - /// let negative_zero = -0.0_f16; - /// - /// assert_eq!(positive.sqrt(), 2.0); - /// assert!(negative.sqrt().is_nan()); - /// assert!(negative_zero.sqrt() == negative_zero); - /// # } - /// ``` - #[inline] - #[doc(alias = "squareRoot")] - #[rustc_allow_incoherent_impl] - #[unstable(feature = "f16", issue = "116909")] - #[must_use = "method returns a new number and does not mutate the original value"] - pub fn sqrt(self) -> f16 { - unsafe { intrinsics::sqrtf16(self) } - } - /// Returns `e^(self)`, (the exponential function). /// /// # Unspecified precision @@ -465,10 +57,9 @@ impl f16 { /// /// ``` /// #![feature(f16)] - /// # #![cfg_attr(not(bootstrap), feature(cfg_target_has_reliable_f16_f128))] - /// # #![cfg_attr(not(bootstrap), expect(internal_features))] + /// # #![feature(cfg_target_has_reliable_f16_f128)] + /// # #![expect(internal_features)] /// # #[cfg(not(miri))] - /// # #[cfg(not(bootstrap))] /// # #[cfg(target_has_reliable_f16_math)] { /// /// let one = 1.0f16; @@ -500,10 +91,9 @@ impl f16 { /// /// ``` /// #![feature(f16)] - /// # #![cfg_attr(not(bootstrap), feature(cfg_target_has_reliable_f16_f128))] - /// # #![cfg_attr(not(bootstrap), expect(internal_features))] + /// # #![feature(cfg_target_has_reliable_f16_f128)] + /// # #![expect(internal_features)] /// # #[cfg(not(miri))] - /// # #[cfg(not(bootstrap))] /// # #[cfg(target_has_reliable_f16_math)] { /// /// let f = 2.0f16; @@ -535,10 +125,9 @@ impl f16 { /// /// ``` /// #![feature(f16)] - /// # #![cfg_attr(not(bootstrap), feature(cfg_target_has_reliable_f16_f128))] - /// # #![cfg_attr(not(bootstrap), expect(internal_features))] + /// # #![feature(cfg_target_has_reliable_f16_f128)] + /// # #![expect(internal_features)] /// # #[cfg(not(miri))] - /// # #[cfg(not(bootstrap))] /// # #[cfg(target_has_reliable_f16_math)] { /// /// let one = 1.0f16; @@ -555,10 +144,9 @@ impl f16 { /// Non-positive values: /// ``` /// #![feature(f16)] - /// # #![cfg_attr(not(bootstrap), feature(cfg_target_has_reliable_f16_f128))] - /// # #![cfg_attr(not(bootstrap), expect(internal_features))] + /// # #![feature(cfg_target_has_reliable_f16_f128)] + /// # #![expect(internal_features)] /// # #[cfg(not(miri))] - /// # #[cfg(not(bootstrap))] /// # #[cfg(target_has_reliable_f16_math)] { /// /// assert_eq!(0_f16.ln(), f16::NEG_INFINITY); @@ -590,10 +178,9 @@ impl f16 { /// /// ``` /// #![feature(f16)] - /// # #![cfg_attr(not(bootstrap), feature(cfg_target_has_reliable_f16_f128))] - /// # #![cfg_attr(not(bootstrap), expect(internal_features))] + /// # #![feature(cfg_target_has_reliable_f16_f128)] + /// # #![expect(internal_features)] /// # #[cfg(not(miri))] - /// # #[cfg(not(bootstrap))] /// # #[cfg(target_has_reliable_f16_math)] { /// /// let five = 5.0f16; @@ -608,10 +195,9 @@ impl f16 { /// Non-positive values: /// ``` /// #![feature(f16)] - /// # #![cfg_attr(not(bootstrap), feature(cfg_target_has_reliable_f16_f128))] - /// # #![cfg_attr(not(bootstrap), expect(internal_features))] + /// # #![feature(cfg_target_has_reliable_f16_f128)] + /// # #![expect(internal_features)] /// # #[cfg(not(miri))] - /// # #[cfg(not(bootstrap))] /// # #[cfg(target_has_reliable_f16_math)] { /// /// assert_eq!(0_f16.log(10.0), f16::NEG_INFINITY); @@ -639,10 +225,9 @@ impl f16 { /// /// ``` /// #![feature(f16)] - /// # #![cfg_attr(not(bootstrap), feature(cfg_target_has_reliable_f16_f128))] - /// # #![cfg_attr(not(bootstrap), expect(internal_features))] + /// # #![feature(cfg_target_has_reliable_f16_f128)] + /// # #![expect(internal_features)] /// # #[cfg(not(miri))] - /// # #[cfg(not(bootstrap))] /// # #[cfg(target_has_reliable_f16_math)] { /// /// let two = 2.0f16; @@ -657,10 +242,9 @@ impl f16 { /// Non-positive values: /// ``` /// #![feature(f16)] - /// # #![cfg_attr(not(bootstrap), feature(cfg_target_has_reliable_f16_f128))] - /// # #![cfg_attr(not(bootstrap), expect(internal_features))] + /// # #![feature(cfg_target_has_reliable_f16_f128)] + /// # #![expect(internal_features)] /// # #[cfg(not(miri))] - /// # #[cfg(not(bootstrap))] /// # #[cfg(target_has_reliable_f16_math)] { /// /// assert_eq!(0_f16.log2(), f16::NEG_INFINITY); @@ -688,10 +272,9 @@ impl f16 { /// /// ``` /// #![feature(f16)] - /// # #![cfg_attr(not(bootstrap), feature(cfg_target_has_reliable_f16_f128))] - /// # #![cfg_attr(not(bootstrap), expect(internal_features))] + /// # #![feature(cfg_target_has_reliable_f16_f128)] + /// # #![expect(internal_features)] /// # #[cfg(not(miri))] - /// # #[cfg(not(bootstrap))] /// # #[cfg(target_has_reliable_f16_math)] { /// /// let ten = 10.0f16; @@ -706,10 +289,9 @@ impl f16 { /// Non-positive values: /// ``` /// #![feature(f16)] - /// # #![cfg_attr(not(bootstrap), feature(cfg_target_has_reliable_f16_f128))] - /// # #![cfg_attr(not(bootstrap), expect(internal_features))] + /// # #![feature(cfg_target_has_reliable_f16_f128)] + /// # #![expect(internal_features)] /// # #[cfg(not(miri))] - /// # #[cfg(not(bootstrap))] /// # #[cfg(target_has_reliable_f16_math)] { /// /// assert_eq!(0_f16.log10(), f16::NEG_INFINITY); @@ -724,42 +306,6 @@ impl f16 { unsafe { intrinsics::log10f16(self) } } - /// Returns the cube root of a number. - /// - /// # Unspecified precision - /// - /// The precision of this function is non-deterministic. This means it varies by platform, - /// Rust version, and can even differ within the same execution from one invocation to the next. - /// - /// This function currently corresponds to the `cbrtf` from libc on Unix - /// and Windows. Note that this might change in the future. - /// - /// # Examples - /// - /// ``` - /// #![feature(f16)] - /// # #![cfg_attr(not(bootstrap), feature(cfg_target_has_reliable_f16_f128))] - /// # #![cfg_attr(not(bootstrap), expect(internal_features))] - /// # #[cfg(not(miri))] - /// # #[cfg(not(bootstrap))] - /// # #[cfg(target_has_reliable_f16_math)] { - /// - /// let x = 8.0f16; - /// - /// // x^(1/3) - 2 == 0 - /// let abs_difference = (x.cbrt() - 2.0).abs(); - /// - /// assert!(abs_difference <= f16::EPSILON); - /// # } - /// ``` - #[inline] - #[rustc_allow_incoherent_impl] - #[unstable(feature = "f16", issue = "116909")] - #[must_use = "method returns a new number and does not mutate the original value"] - pub fn cbrt(self) -> f16 { - cmath::cbrtf(self as f32) as f16 - } - /// Compute the distance between the origin and a point (`x`, `y`) on the /// Euclidean plane. Equivalently, compute the length of the hypotenuse of a /// right-angle triangle with other sides having length `x.abs()` and @@ -777,10 +323,9 @@ impl f16 { /// /// ``` /// #![feature(f16)] - /// # #![cfg_attr(not(bootstrap), feature(cfg_target_has_reliable_f16_f128))] - /// # #![cfg_attr(not(bootstrap), expect(internal_features))] + /// # #![feature(cfg_target_has_reliable_f16_f128)] + /// # #![expect(internal_features)] /// # #[cfg(not(miri))] - /// # #[cfg(not(bootstrap))] /// # #[cfg(target_has_reliable_f16_math)] { /// /// let x = 2.0f16; @@ -811,10 +356,9 @@ impl f16 { /// /// ``` /// #![feature(f16)] - /// # #![cfg_attr(not(bootstrap), feature(cfg_target_has_reliable_f16_f128))] - /// # #![cfg_attr(not(bootstrap), expect(internal_features))] + /// # #![feature(cfg_target_has_reliable_f16_f128)] + /// # #![expect(internal_features)] /// # #[cfg(not(miri))] - /// # #[cfg(not(bootstrap))] /// # #[cfg(target_has_reliable_f16_math)] { /// /// let x = std::f16::consts::FRAC_PI_2; @@ -843,10 +387,9 @@ impl f16 { /// /// ``` /// #![feature(f16)] - /// # #![cfg_attr(not(bootstrap), feature(cfg_target_has_reliable_f16_f128))] - /// # #![cfg_attr(not(bootstrap), expect(internal_features))] + /// # #![feature(cfg_target_has_reliable_f16_f128)] + /// # #![expect(internal_features)] /// # #[cfg(not(miri))] - /// # #[cfg(not(bootstrap))] /// # #[cfg(target_has_reliable_f16_math)] { /// /// let x = 2.0 * std::f16::consts::PI; @@ -878,10 +421,9 @@ impl f16 { /// /// ``` /// #![feature(f16)] - /// # #![cfg_attr(not(bootstrap), feature(cfg_target_has_reliable_f16_f128))] - /// # #![cfg_attr(not(bootstrap), expect(internal_features))] + /// # #![feature(cfg_target_has_reliable_f16_f128)] + /// # #![expect(internal_features)] /// # #[cfg(not(miri))] - /// # #[cfg(not(bootstrap))] /// # #[cfg(target_has_reliable_f16_math)] { /// /// let x = std::f16::consts::FRAC_PI_4; @@ -914,10 +456,9 @@ impl f16 { /// /// ``` /// #![feature(f16)] - /// # #![cfg_attr(not(bootstrap), feature(cfg_target_has_reliable_f16_f128))] - /// # #![cfg_attr(not(bootstrap), expect(internal_features))] + /// # #![feature(cfg_target_has_reliable_f16_f128)] + /// # #![expect(internal_features)] /// # #[cfg(not(miri))] - /// # #[cfg(not(bootstrap))] /// # #[cfg(target_has_reliable_f16_math)] { /// /// let f = std::f16::consts::FRAC_PI_2; @@ -953,10 +494,9 @@ impl f16 { /// /// ``` /// #![feature(f16)] - /// # #![cfg_attr(not(bootstrap), feature(cfg_target_has_reliable_f16_f128))] - /// # #![cfg_attr(not(bootstrap), expect(internal_features))] + /// # #![feature(cfg_target_has_reliable_f16_f128)] + /// # #![expect(internal_features)] /// # #[cfg(not(miri))] - /// # #[cfg(not(bootstrap))] /// # #[cfg(target_has_reliable_f16_math)] { /// /// let f = std::f16::consts::FRAC_PI_4; @@ -991,10 +531,9 @@ impl f16 { /// /// ``` /// #![feature(f16)] - /// # #![cfg_attr(not(bootstrap), feature(cfg_target_has_reliable_f16_f128))] - /// # #![cfg_attr(not(bootstrap), expect(internal_features))] + /// # #![feature(cfg_target_has_reliable_f16_f128)] + /// # #![expect(internal_features)] /// # #[cfg(not(miri))] - /// # #[cfg(not(bootstrap))] /// # #[cfg(target_has_reliable_f16_math)] { /// /// let f = 1.0f16; @@ -1033,10 +572,9 @@ impl f16 { /// /// ``` /// #![feature(f16)] - /// # #![cfg_attr(not(bootstrap), feature(cfg_target_has_reliable_f16_f128))] - /// # #![cfg_attr(not(bootstrap), expect(internal_features))] + /// # #![feature(cfg_target_has_reliable_f16_f128)] + /// # #![expect(internal_features)] /// # #[cfg(not(miri))] - /// # #[cfg(not(bootstrap))] /// # #[cfg(target_has_reliable_f16_math)] { /// /// // Positive angles measured counter-clockwise @@ -1079,10 +617,9 @@ impl f16 { /// /// ``` /// #![feature(f16)] - /// # #![cfg_attr(not(bootstrap), feature(cfg_target_has_reliable_f16_f128))] - /// # #![cfg_attr(not(bootstrap), expect(internal_features))] + /// # #![feature(cfg_target_has_reliable_f16_f128)] + /// # #![expect(internal_features)] /// # #[cfg(not(miri))] - /// # #[cfg(not(bootstrap))] /// # #[cfg(target_has_reliable_f16_math)] { /// /// let x = std::f16::consts::FRAC_PI_4; @@ -1118,10 +655,9 @@ impl f16 { /// /// ``` /// #![feature(f16)] - /// # #![cfg_attr(not(bootstrap), feature(cfg_target_has_reliable_f16_f128))] - /// # #![cfg_attr(not(bootstrap), expect(internal_features))] + /// # #![feature(cfg_target_has_reliable_f16_f128)] + /// # #![expect(internal_features)] /// # #[cfg(not(miri))] - /// # #[cfg(not(bootstrap))] /// # #[cfg(target_has_reliable_f16_math)] { /// /// let x = 1e-4_f16; @@ -1158,10 +694,9 @@ impl f16 { /// /// ``` /// #![feature(f16)] - /// # #![cfg_attr(not(bootstrap), feature(cfg_target_has_reliable_f16_f128))] - /// # #![cfg_attr(not(bootstrap), expect(internal_features))] + /// # #![feature(cfg_target_has_reliable_f16_f128)] + /// # #![expect(internal_features)] /// # #[cfg(not(miri))] - /// # #[cfg(not(bootstrap))] /// # #[cfg(target_has_reliable_f16_math)] { /// /// let x = 1e-4_f16; @@ -1177,10 +712,9 @@ impl f16 { /// Out-of-range values: /// ``` /// #![feature(f16)] - /// # #![cfg_attr(not(bootstrap), feature(cfg_target_has_reliable_f16_f128))] - /// # #![cfg_attr(not(bootstrap), expect(internal_features))] + /// # #![feature(cfg_target_has_reliable_f16_f128)] + /// # #![expect(internal_features)] /// # #[cfg(not(miri))] - /// # #[cfg(not(bootstrap))] /// # #[cfg(target_has_reliable_f16_math)] { /// /// assert_eq!((-1.0_f16).ln_1p(), f16::NEG_INFINITY); @@ -1210,10 +744,9 @@ impl f16 { /// /// ``` /// #![feature(f16)] - /// # #![cfg_attr(not(bootstrap), feature(cfg_target_has_reliable_f16_f128))] - /// # #![cfg_attr(not(bootstrap), expect(internal_features))] + /// # #![feature(cfg_target_has_reliable_f16_f128)] + /// # #![expect(internal_features)] /// # #[cfg(not(miri))] - /// # #[cfg(not(bootstrap))] /// # #[cfg(target_has_reliable_f16_math)] { /// /// let e = std::f16::consts::E; @@ -1249,10 +782,9 @@ impl f16 { /// /// ``` /// #![feature(f16)] - /// # #![cfg_attr(not(bootstrap), feature(cfg_target_has_reliable_f16_f128))] - /// # #![cfg_attr(not(bootstrap), expect(internal_features))] + /// # #![feature(cfg_target_has_reliable_f16_f128)] + /// # #![expect(internal_features)] /// # #[cfg(not(miri))] - /// # #[cfg(not(bootstrap))] /// # #[cfg(target_has_reliable_f16_math)] { /// /// let e = std::f16::consts::E; @@ -1288,10 +820,9 @@ impl f16 { /// /// ``` /// #![feature(f16)] - /// # #![cfg_attr(not(bootstrap), feature(cfg_target_has_reliable_f16_f128))] - /// # #![cfg_attr(not(bootstrap), expect(internal_features))] + /// # #![feature(cfg_target_has_reliable_f16_f128)] + /// # #![expect(internal_features)] /// # #[cfg(not(miri))] - /// # #[cfg(not(bootstrap))] /// # #[cfg(target_has_reliable_f16_math)] { /// /// let e = std::f16::consts::E; @@ -1324,10 +855,9 @@ impl f16 { /// /// ``` /// #![feature(f16)] - /// # #![cfg_attr(not(bootstrap), feature(cfg_target_has_reliable_f16_f128))] - /// # #![cfg_attr(not(bootstrap), expect(internal_features))] + /// # #![feature(cfg_target_has_reliable_f16_f128)] + /// # #![expect(internal_features)] /// # #[cfg(not(miri))] - /// # #[cfg(not(bootstrap))] /// # #[cfg(target_has_reliable_f16_math)] { /// /// let x = 1.0f16; @@ -1360,10 +890,9 @@ impl f16 { /// /// ``` /// #![feature(f16)] - /// # #![cfg_attr(not(bootstrap), feature(cfg_target_has_reliable_f16_f128))] - /// # #![cfg_attr(not(bootstrap), expect(internal_features))] + /// # #![feature(cfg_target_has_reliable_f16_f128)] + /// # #![expect(internal_features)] /// # #[cfg(not(miri))] - /// # #[cfg(not(bootstrap))] /// # #[cfg(target_has_reliable_f16_math)] { /// /// let x = 1.0f16; @@ -1398,10 +927,9 @@ impl f16 { /// /// ``` /// #![feature(f16)] - /// # #![cfg_attr(not(bootstrap), feature(cfg_target_has_reliable_f16_f128))] - /// # #![cfg_attr(not(bootstrap), expect(internal_features))] + /// # #![feature(cfg_target_has_reliable_f16_f128)] + /// # #![expect(internal_features)] /// # #[cfg(not(miri))] - /// # #[cfg(not(bootstrap))] /// # #[cfg(target_has_reliable_f16_math)] { /// /// let e = std::f16::consts::E; @@ -1436,10 +964,9 @@ impl f16 { /// ``` /// #![feature(f16)] /// #![feature(float_gamma)] - /// # #![cfg_attr(not(bootstrap), feature(cfg_target_has_reliable_f16_f128))] - /// # #![cfg_attr(not(bootstrap), expect(internal_features))] + /// # #![feature(cfg_target_has_reliable_f16_f128)] + /// # #![expect(internal_features)] /// # #[cfg(not(miri))] - /// # #[cfg(not(bootstrap))] /// # #[cfg(target_has_reliable_f16_math)] { /// /// let x = 5.0f16; @@ -1475,10 +1002,9 @@ impl f16 { /// ``` /// #![feature(f16)] /// #![feature(float_gamma)] - /// # #![cfg_attr(not(bootstrap), feature(cfg_target_has_reliable_f16_f128))] - /// # #![cfg_attr(not(bootstrap), expect(internal_features))] + /// # #![feature(cfg_target_has_reliable_f16_f128)] + /// # #![expect(internal_features)] /// # #[cfg(not(miri))] - /// # #[cfg(not(bootstrap))] /// # #[cfg(target_has_reliable_f16_math)] { /// /// let x = 2.0f16; @@ -1514,10 +1040,9 @@ impl f16 { /// ``` /// #![feature(f16)] /// #![feature(float_erf)] - /// # #![cfg_attr(not(bootstrap), feature(cfg_target_has_reliable_f16_f128))] - /// # #![cfg_attr(not(bootstrap), expect(internal_features))] + /// # #![feature(cfg_target_has_reliable_f16_f128)] + /// # #![expect(internal_features)] /// # #[cfg(not(miri))] - /// # #[cfg(not(bootstrap))] /// # #[cfg(target_has_reliable_f16_math)] { /// /// The error function relates what percent of a normal distribution lies /// /// within `x` standard deviations (scaled by `1/sqrt(2)`). @@ -1557,10 +1082,9 @@ impl f16 { /// ``` /// #![feature(f16)] /// #![feature(float_erf)] - /// # #![cfg_attr(not(bootstrap), feature(cfg_target_has_reliable_f16_f128))] - /// # #![cfg_attr(not(bootstrap), expect(internal_features))] + /// # #![feature(cfg_target_has_reliable_f16_f128)] + /// # #![expect(internal_features)] /// # #[cfg(not(miri))] - /// # #[cfg(not(bootstrap))] /// # #[cfg(target_has_reliable_f16_math)] { /// let x: f16 = 0.123; /// |
