Trait argmin::prelude::ops::mul_add::MulAdd [−][src]
pub trait MulAdd<A = Self, B = Self> { type Output; pub fn mul_add(self, a: A, b: B) -> Self::Output; }
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 std::f32; let m = 10.0_f32; let x = 4.0_f32; let b = 60.0_f32; // 100.0 let abs_difference = (m.mul_add(x, b) - (m*x + b)).abs(); assert!(abs_difference <= 100.0 * f32::EPSILON);
Associated Types
Loading content...Required methods
Loading content...Implementations on Foreign Types
impl<T> MulAdd<Complex<T>, Complex<T>> for Complex<T> where
T: Clone + Num + MulAdd<T, T, Output = T>,
[src]
impl<T> MulAdd<Complex<T>, Complex<T>> for Complex<T> where
T: Clone + Num + MulAdd<T, T, Output = T>,
[src]impl<'a, 'b, T> MulAdd<&'b Complex<T>, &'a Complex<T>> for &'a Complex<T> where
T: Clone + Num + MulAdd<T, T, Output = T>,
[src]
impl<'a, 'b, T> MulAdd<&'b Complex<T>, &'a Complex<T>> for &'a Complex<T> where
T: Clone + Num + MulAdd<T, T, Output = T>,
[src]impl<T> MulAdd<Complex<T>, Complex<T>> for Complex<T> where
T: Clone + Num + MulAdd<T, T, Output = T>,
[src]
impl<T> MulAdd<Complex<T>, Complex<T>> for Complex<T> where
T: Clone + Num + MulAdd<T, T, Output = T>,
[src]impl<'a, 'b, T> MulAdd<&'b Complex<T>, &'a Complex<T>> for &'a Complex<T> where
T: Clone + Num + MulAdd<T, T, Output = T>,
[src]
impl<'a, 'b, T> MulAdd<&'b Complex<T>, &'a Complex<T>> for &'a Complex<T> where
T: Clone + Num + MulAdd<T, T, Output = T>,
[src]