about summary refs log tree commit diff
path: root/library/core/src/num/f16.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-08-27 06:50:08 +0000
committerbors <bors@rust-lang.org>2024-08-27 06:50:08 +0000
commitae9f5019f9ce6eb3ecd96206ade4a612efe20fd5 (patch)
treec61f5e579ba5e934edefaa3824cea1b636004fd7 /library/core/src/num/f16.rs
parentbf662eb80838008acabc307dd64d84935ce3a20d (diff)
parent75ae913ec000753bc34efd8b37cf2a4b26f13041 (diff)
downloadrust-ae9f5019f9ce6eb3ecd96206ade4a612efe20fd5.tar.gz
rust-ae9f5019f9ce6eb3ecd96206ade4a612efe20fd5.zip
Auto merge of #129647 - tgross35:rollup-jume49s, r=tgross35
Rollup of 9 pull requests

Successful merges:

 - #126985 (Implement `-Z embed-source` (DWARFv5 source code embedding extension))
 - #127922 (Add unsafe to extern blocks in style guide)
 - #128731 (simd_shuffle intrinsic: allow argument to be passed as vector)
 - #128935 (More work on `zstd` compression)
 - #128942 (miri weak memory emulation: put previous value into initial store buffer)
 - #129418 (rustc: Simplify getting sysroot library directory)
 - #129490 (Add Trusty OS as tier 3 target)
 - #129536 (Add `f16` and `f128` inline ASM support for `aarch64`)
 - #129559 (float types: document NaN bit pattern guarantees)

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'library/core/src/num/f16.rs')
-rw-r--r--library/core/src/num/f16.rs30
1 files changed, 18 insertions, 12 deletions
diff --git a/library/core/src/num/f16.rs b/library/core/src/num/f16.rs
index bb0cc1c60ba..1e2f841aca7 100644
--- a/library/core/src/num/f16.rs
+++ b/library/core/src/num/f16.rs
@@ -464,11 +464,14 @@ impl f16 {
     }
 
     /// Returns `true` if `self` has a positive sign, including `+0.0`, NaNs with
-    /// positive sign bit and positive infinity. Note that IEEE 754 doesn't assign any
-    /// meaning to the sign bit in case of a NaN, and as Rust doesn't guarantee that
-    /// the bit pattern of NaNs are conserved over arithmetic operations, the result of
-    /// `is_sign_positive` on a NaN might produce an unexpected result in some cases.
-    /// See [explanation of NaN as a special value](f16) for more info.
+    /// positive sign bit and positive infinity.
+    ///
+    /// Note that IEEE 754 doesn't assign any meaning to the sign bit in case of
+    /// a NaN, and as Rust doesn't guarantee that the bit pattern of NaNs are
+    /// conserved over arithmetic operations, the result of `is_sign_positive` on
+    /// a NaN might produce an unexpected or non-portable result. See the [specification
+    /// of NaN bit patterns](f32#nan-bit-patterns) for more info. Use `self.signum() == 1.0`
+    /// if you need fully portable behavior (will return `false` for all NaNs).
     ///
     /// ```
     /// #![feature(f16)]
@@ -490,11 +493,14 @@ impl f16 {
     }
 
     /// Returns `true` if `self` has a negative sign, including `-0.0`, NaNs with
-    /// negative sign bit and negative infinity. Note that IEEE 754 doesn't assign any
-    /// meaning to the sign bit in case of a NaN, and as Rust doesn't guarantee that
-    /// the bit pattern of NaNs are conserved over arithmetic operations, the result of
-    /// `is_sign_negative` on a NaN might produce an unexpected result in some cases.
-    /// See [explanation of NaN as a special value](f16) for more info.
+    /// negative sign bit and negative infinity.
+    ///
+    /// Note that IEEE 754 doesn't assign any meaning to the sign bit in case of
+    /// a NaN, and as Rust doesn't guarantee that the bit pattern of NaNs are
+    /// conserved over arithmetic operations, the result of `is_sign_negative` on
+    /// a NaN might produce an unexpected or non-portable result. See the [specification
+    /// of NaN bit patterns](f32#nan-bit-patterns) for more info. Use `self.signum() == -1.0`
+    /// if you need fully portable behavior (will return `false` for all NaNs).
     ///
     /// ```
     /// #![feature(f16)]
@@ -762,7 +768,7 @@ impl f16 {
     /// Note that this follows the semantics specified in IEEE 754-2019.
     ///
     /// Also note that "propagation" of NaNs here doesn't necessarily mean that the bitpattern of a NaN
-    /// operand is conserved; see [explanation of NaN as a special value](f16) for more info.
+    /// operand is conserved; see the [specification of NaN bit patterns](f32#nan-bit-patterns) for more info.
     #[inline]
     #[unstable(feature = "f16", issue = "116909")]
     // #[unstable(feature = "float_minimum_maximum", issue = "91079")]
@@ -802,7 +808,7 @@ impl f16 {
     /// Note that this follows the semantics specified in IEEE 754-2019.
     ///
     /// Also note that "propagation" of NaNs here doesn't necessarily mean that the bitpattern of a NaN
-    /// operand is conserved; see [explanation of NaN as a special value](f16) for more info.
+    /// operand is conserved; see the [specification of NaN bit patterns](f32#nan-bit-patterns) for more info.
     #[inline]
     #[unstable(feature = "f16", issue = "116909")]
     // #[unstable(feature = "float_minimum_maximum", issue = "91079")]