Average Error: 0.0 → 0
Time: 5.6s
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 r450855 = x;
        double r450856 = y;
        double r450857 = z;
        double r450858 = r450856 * r450857;
        double r450859 = r450855 - r450858;
        return r450859;
}

double f(double x, double y, double z) {
        double r450860 = y;
        double r450861 = -r450860;
        double r450862 = z;
        double r450863 = x;
        double r450864 = fma(r450861, r450862, r450863);
        return r450864;
}

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-sqr-sqrt31.9

    \[\leadsto \color{blue}{\sqrt{x - y \cdot z} \cdot \sqrt{x - y \cdot z}}\]
  4. Using strategy rm
  5. Applied pow131.9

    \[\leadsto \sqrt{x - y \cdot z} \cdot \color{blue}{{\left(\sqrt{x - y \cdot z}\right)}^{1}}\]
  6. Applied pow131.9

    \[\leadsto \color{blue}{{\left(\sqrt{x - y \cdot z}\right)}^{1}} \cdot {\left(\sqrt{x - y \cdot z}\right)}^{1}\]
  7. Applied pow-prod-down31.9

    \[\leadsto \color{blue}{{\left(\sqrt{x - y \cdot z} \cdot \sqrt{x - y \cdot z}\right)}^{1}}\]
  8. Simplified0

    \[\leadsto {\color{blue}{\left(\mathsf{fma}\left(-y, z, x\right)\right)}}^{1}\]
  9. Final simplification0

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

Reproduce

herbie shell --seed 2020043 +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)))