about summary refs log tree commit diff
path: root/library/std/src/f128.rs
diff options
context:
space:
mode:
authorRalf Jung <post@ralfj.de>2024-08-28 12:06:28 +0200
committerRalf Jung <post@ralfj.de>2024-08-28 12:06:28 +0200
commit0589dc75d314152de3ddf095ff2fc774c4a2d9c1 (patch)
tree1d85ce2a142984bff2d2d40b909226122f91e97d /library/std/src/f128.rs
parentd9a2cc4daee38c63b2f69710ed61d40acc32b709 (diff)
downloadrust-0589dc75d314152de3ddf095ff2fc774c4a2d9c1.tar.gz
rust-0589dc75d314152de3ddf095ff2fc774c4a2d9c1.zip
copysign with sign being a NaN is non-portable
Diffstat (limited to 'library/std/src/f128.rs')
-rw-r--r--library/std/src/f128.rs11
1 files changed, 8 insertions, 3 deletions
diff --git a/library/std/src/f128.rs b/library/std/src/f128.rs
index 506d708d0d2..b436fe9929c 100644
--- a/library/std/src/f128.rs
+++ b/library/std/src/f128.rs
@@ -250,9 +250,14 @@ impl f128 {
     ///
     /// Equal to `self` if the sign of `self` and `sign` are the same, otherwise equal to `-self`.
     /// If `self` is a NaN, then a NaN with the same payload as `self` and the sign bit of `sign` is
-    /// returned. Note, however, that conserving the sign bit on NaN across arithmetical operations
-    /// is not generally guaranteed. See [specification of NaN bit
-    /// patterns](primitive@f32#nan-bit-patterns) for more info.
+    /// returned.
+    ///
+    /// If `sign` is a NaN, then this operation will still carry over its sign into the result. 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 `copysign` with `sign` being a NaN might produce an unexpected or non-portable
+    /// result. See the [specification of NaN bit patterns](primitive@f32#nan-bit-patterns) for more
+    /// info.
     ///
     /// # Examples
     ///