Average Error: 0.0 → 0.0
Time: 2.8s
Precision: 64
\[\left(1 - x\right) \cdot y + x \cdot z\]
\[\mathsf{fma}\left(1 - x, y, x \cdot z\right)\]
\left(1 - x\right) \cdot y + x \cdot z
\mathsf{fma}\left(1 - x, y, x \cdot z\right)
double code(double x, double y, double z) {
	return (((1.0 - x) * y) + (x * z));
}
double code(double x, double y, double z) {
	return fma((1.0 - x), y, (x * z));
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original0.0
Target0.0
Herbie0.0
\[y - x \cdot \left(y - z\right)\]

Derivation

  1. Initial program 0.0

    \[\left(1 - x\right) \cdot y + x \cdot z\]
  2. Simplified0.0

    \[\leadsto \color{blue}{\mathsf{fma}\left(1 - x, y, x \cdot z\right)}\]
  3. Final simplification0.0

    \[\leadsto \mathsf{fma}\left(1 - x, y, x \cdot z\right)\]

Reproduce

herbie shell --seed 2020057 +o rules:numerics
(FPCore (x y z)
  :name "Diagrams.Color.HSV:lerp  from diagrams-contrib-1.3.0.5"
  :precision binary64

  :herbie-target
  (- y (* x (- y z)))

  (+ (* (- 1 x) y) (* x z)))