Average Error: 0.0 → 0.0
Time: 1.8s
Precision: binary64
\[x - y \cdot z \]
\[\left(x - z \cdot y\right) + \mathsf{fma}\left(-z, y, z \cdot y\right) \]
x - y \cdot z
\left(x - z \cdot y\right) + \mathsf{fma}\left(-z, y, z \cdot y\right)
(FPCore (x y z) :precision binary64 (- x (* y z)))
(FPCore (x y z) :precision binary64 (+ (- x (* z y)) (fma (- z) y (* z y))))
double code(double x, double y, double z) {
	return x - (y * z);
}
double code(double x, double y, double z) {
	return (x - (z * y)) + fma(-z, y, (z * y));
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Target

Original0.0
Target0.0
Herbie0.0
\[\frac{x + y \cdot z}{\frac{x + y \cdot z}{x - y \cdot z}} \]

Derivation

  1. Initial program 0.0

    \[x - y \cdot z \]
  2. Applied *-un-lft-identity_binary640.0

    \[\leadsto \color{blue}{1 \cdot x} - y \cdot z \]
  3. Applied prod-diff_binary640.0

    \[\leadsto \color{blue}{\mathsf{fma}\left(1, x, -z \cdot y\right) + \mathsf{fma}\left(-z, y, z \cdot y\right)} \]
  4. Applied fma-udef_binary640.0

    \[\leadsto \color{blue}{\left(1 \cdot x + \left(-z \cdot y\right)\right)} + \mathsf{fma}\left(-z, y, z \cdot y\right) \]
  5. Simplified0.0

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

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

Reproduce

herbie shell --seed 2022067 
(FPCore (x y z)
  :name "Diagrams.Solve.Tridiagonal:solveTriDiagonal from diagrams-solve-0.1, C"
  :precision binary64

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

  (- x (* y z)))