Skip to content

Commit 230032b

Browse files
committed
Add reordering example to central docs.
1 parent 4b4e6d9 commit 230032b

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

library/core/src/primitive_docs.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1331,6 +1331,19 @@ mod prim_f16 {}
13311331
/// different results even within a single program run. **Unsafe code must not rely on any property
13321332
/// of the return value for soundness.** However, implementations will generally do their best to
13331333
/// pick a reasonable tradeoff between performance and accuracy of the result.
1334+
///
1335+
/// For example:
1336+
///
1337+
/// ```
1338+
/// x = x.algebraic_add(x, a.algebraic_mul(b));
1339+
/// ```
1340+
///
1341+
/// May be rewritten as either:
1342+
///
1343+
/// ```
1344+
/// x = x + (a * b); // As written
1345+
/// x = (a * b) + x; // Reordered to allow using a single `fma`
1346+
/// ```
13341347
13351348
#[stable(feature = "rust1", since = "1.0.0")]
13361349
mod prim_f32 {}

0 commit comments

Comments
 (0)