Skip to content

Commit

Permalink
Clarify in the docs that mul_add is not always faster.
Browse files Browse the repository at this point in the history
  • Loading branch information
frewsxcv committed May 9, 2018
1 parent 8ff4b42 commit 0ba1c10
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 4 additions & 2 deletions src/libstd/f32.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,10 @@ impl f32 {
}

/// Fused multiply-add. Computes `(self * a) + b` with only one rounding
/// error. This produces a more accurate result with better performance than
/// a separate multiplication operation followed by an add.
/// 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.
///
/// ```
/// use std::f32;
Expand Down
6 changes: 4 additions & 2 deletions src/libstd/f64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,10 @@ impl f64 {
}

/// Fused multiply-add. Computes `(self * a) + b` with only one rounding
/// error. This produces a more accurate result with better performance than
/// a separate multiplication operation followed by an add.
/// 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.
///
/// ```
/// let m = 10.0_f64;
Expand Down

0 comments on commit 0ba1c10

Please sign in to comment.