Average Error: 0.0 → 0
Time: 3.7s
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 r437222 = x;
        double r437223 = y;
        double r437224 = z;
        double r437225 = r437223 * r437224;
        double r437226 = r437222 - r437225;
        return r437226;
}

double f(double x, double y, double z) {
        double r437227 = y;
        double r437228 = z;
        double r437229 = -r437228;
        double r437230 = x;
        double r437231 = fma(r437227, r437229, r437230);
        return r437231;
}

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 2019347 +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)))