Skip to content

Commit

Permalink
Rollup merge of #77027 - termhn:mul_add_doc_change, r=m-ou-se
Browse files Browse the repository at this point in the history
Improve documentation for `std::{f32,f64}::mul_add`

Makes it more clear that performance improvement is not guaranteed when using FMA, even when the target architecture supports it natively.
  • Loading branch information
tmandry committed Dec 11, 2020
2 parents 0c9ef56 + a6d98d8 commit 1b4ffe4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 4 additions & 2 deletions library/std/src/f32.rs
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,10 @@ impl f32 {
/// 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` can be more performant than an unfused multiply-add if
/// the target architecture has a dedicated `fma` CPU instruction.
/// 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.
///
/// # Examples
///
Expand Down
6 changes: 4 additions & 2 deletions library/std/src/f64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,10 @@ impl f64 {
/// 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` can be more performant than an unfused multiply-add if
/// the target architecture has a dedicated `fma` CPU instruction.
/// 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.
///
/// # Examples
///
Expand Down

0 comments on commit 1b4ffe4

Please sign in to comment.