Average Error: 0.0 → 0.0
Time: 4.0s
Precision: 64
\[x - y \cdot z\]
\[\mathsf{fma}\left(-z, y, y \cdot z\right) + \left(x - y \cdot z\right)\]
x - y \cdot z
\mathsf{fma}\left(-z, y, y \cdot z\right) + \left(x - y \cdot z\right)
double f(double x, double y, double z) {
        double r12749134 = x;
        double r12749135 = y;
        double r12749136 = z;
        double r12749137 = r12749135 * r12749136;
        double r12749138 = r12749134 - r12749137;
        return r12749138;
}

double f(double x, double y, double z) {
        double r12749139 = z;
        double r12749140 = -r12749139;
        double r12749141 = y;
        double r12749142 = r12749141 * r12749139;
        double r12749143 = fma(r12749140, r12749141, r12749142);
        double r12749144 = x;
        double r12749145 = r12749144 - r12749142;
        double r12749146 = r12749143 + r12749145;
        return r12749146;
}

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. 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}{\left(x - z \cdot y\right)} + \mathsf{fma}\left(-z, y, z \cdot y\right)\]
  6. Final simplification0.0

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

Reproduce

herbie shell --seed 2019156 +o rules:numerics
(FPCore (x y z)
  :name "Diagrams.Solve.Tridiagonal:solveTriDiagonal from diagrams-solve-0.1, C"

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

  (- x (* y z)))