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 r76963 = x;
        double r76964 = y;
        double r76965 = z;
        double r76966 = r76964 * r76965;
        double r76967 = r76963 - r76966;
        return r76967;
}

double f(double x, double y, double z) {
        double r76968 = y;
        double r76969 = z;
        double r76970 = -r76969;
        double r76971 = x;
        double r76972 = fma(r76968, r76970, r76971);
        return r76972;
}

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