Skip to content

Commit f4db632

Browse files
bors[bot]rs017991
andauthored
Merge #275
275: Clarify `mul_add` Docs r=cuviper a=rs017991 There is some great documentation on the `MulAdd` trait itself, but in cases where you only see the method doc (like hovering in an IDE), it's not clear what operation will take place. Sometimes I remember what role each of the three numbers has, and even where the parens are, but either way it breaks my concentration having to drill into the impl to find the trait doc to double-check my assumptions. Short of copy-pasting the excellent `MulAdd` trait doc everywhere, I think that just including the pseudocode describing the operation (as I've done in this PR) will go a long way in clarifying what it does. Co-authored-by: Ryan Scheidter <ryan.scheidter@gmail.com>
2 parents 4ac94b4 + d3b0c12 commit f4db632

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/ops/mul_add.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@ pub trait MulAdd<A = Self, B = Self> {
2424
/// The resulting type after applying the fused multiply-add.
2525
type Output;
2626

27-
/// Performs the fused multiply-add operation.
27+
/// Performs the fused multiply-add operation `(self * a) + b`
2828
fn mul_add(self, a: A, b: B) -> Self::Output;
2929
}
3030

31-
/// The fused multiply-add assignment operation.
31+
/// The fused multiply-add assignment operation `*self = (*self * a) + b`
3232
pub trait MulAddAssign<A = Self, B = Self> {
33-
/// Performs the fused multiply-add operation.
33+
/// Performs the fused multiply-add assignment operation `*self = (*self * a) + b`
3434
fn mul_add_assign(&mut self, a: A, b: B);
3535
}
3636

0 commit comments

Comments
 (0)