Average Error: 0.0 → 0
Time: 4.1s
Precision: 64
\[x - y \cdot z\]
\[\mathsf{fma}\left(y, -z, x\right)\]
x - y \cdot z
\mathsf{fma}\left(y, -z, x\right)
double f(double x, double y, double z) {
        double r512391 = x;
        double r512392 = y;
        double r512393 = z;
        double r512394 = r512392 * r512393;
        double r512395 = r512391 - r512394;
        return r512395;
}

double f(double x, double y, double z) {
        double r512396 = y;
        double r512397 = z;
        double r512398 = -r512397;
        double r512399 = x;
        double r512400 = fma(r512396, r512398, r512399);
        return r512400;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Target

Original0.0
Target0.0
Herbie0
\[\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. Using strategy rm
  3. Applied add-cube-cbrt0.8

    \[\leadsto \color{blue}{\left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) \cdot \sqrt[3]{x}} - y \cdot z\]
  4. Applied prod-diff0.8

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

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

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

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

Reproduce

herbie shell --seed 2019303 +o rules:numerics
(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)))