Trait num::traits::ops::mul_add::MulAdd [−][src]
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 MulAdd<u128, u128> for u128
[src]
type Output = u128
pub fn mul_add(self, a: u128, b: u128) -> <u128 as MulAdd<u128, u128>>::Output
[src]
impl MulAdd<u64, u64> for u64
[src]
impl MulAdd<usize, usize> for usize
[src]
type Output = usize
pub fn mul_add(
self,
a: usize,
b: usize
) -> <usize as MulAdd<usize, usize>>::Output
[src]
self,
a: usize,
b: usize
) -> <usize as MulAdd<usize, usize>>::Output
impl MulAdd<i16, i16> for i16
[src]
impl MulAdd<i8, i8> for i8
[src]
impl MulAdd<i64, i64> for i64
[src]
impl MulAdd<u8, u8> for u8
[src]
impl MulAdd<f64, f64> for f64
[src]
impl MulAdd<u16, u16> for u16
[src]
impl MulAdd<f32, f32> for f32
[src]
impl MulAdd<u32, u32> for u32
[src]
impl MulAdd<i32, i32> for i32
[src]
impl MulAdd<i128, i128> for i128
[src]
type Output = i128
pub fn mul_add(self, a: i128, b: i128) -> <i128 as MulAdd<i128, i128>>::Output
[src]
impl MulAdd<isize, isize> for isize
[src]
type Output = isize
pub fn mul_add(
self,
a: isize,
b: isize
) -> <isize as MulAdd<isize, isize>>::Output
[src]
self,
a: isize,
b: isize
) -> <isize as MulAdd<isize, isize>>::Output
Implementors
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]
T: Clone + Num + MulAdd<T, T, Output = T>,
type Output = Complex<T>
pub fn mul_add(self, other: &Complex<T>, add: &Complex<T>) -> Complex<T>
[src]
impl<T> MulAdd<Complex<T>, Complex<T>> for Complex<T> where
T: Clone + Num + MulAdd<T, T, Output = T>,
[src]
T: Clone + Num + MulAdd<T, T, Output = T>,