Trait MulAdd
trait MulAdd<A = Self, B = Self>
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.
Note that A and B are Self by default, but this is not mandatory.
Example
use f32;
let m = 10.0_f32;
let x = 4.0_f32;
let b = 60.0_f32;
// 100.0
let abs_difference = .abs;
assert!;
Associated Types
type OutputThe resulting type after applying the fused multiply-add.
Required Methods
fn mul_add(self: Self, a: A, b: B) -> <Self as >::OutputPerforms the fused multiply-add operation
(self * a) + b
Implementors
impl MulAdd for u16impl MulAdd for i16impl MulAdd for u8impl MulAdd for i8impl MulAdd for usizeimpl MulAdd for u128impl MulAdd for isizeimpl MulAdd for i128impl MulAdd for u64impl MulAdd for f64impl MulAdd for i64impl MulAdd for u32impl MulAdd for f32impl MulAdd for i32