pub fn primitive_float_add_mul<T>(x: T, y: T, z: T) -> TExpand description
Adds a primitive float and the product of two other primitive floats with a single rounding,
using emulated Float arithmetic.
This is a correctly-rounded fused multiply-add: the product is not rounded before the addition,
so the result is the true value of $x+yz$ rounded once to the nearest representable value. It
agrees with the standard library’s hardware-backed mul_add, up to argument order.
§Worst-case complexity
Constant time and additional memory.
§Examples
use core::f64::consts::{E, PI, SQRT_2};
use malachite_base::num::float::NiceFloat;
use malachite_float::float::arithmetic::add_mul::*;
assert_eq!(
NiceFloat(primitive_float_add_mul(PI, E, SQRT_2)),
NiceFloat(6.98582368174891)
);