Average Error: 0.0 → 0
Time: 2.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 r789318 = x;
        double r789319 = y;
        double r789320 = z;
        double r789321 = r789319 * r789320;
        double r789322 = r789318 - r789321;
        return r789322;
}

double f(double x, double y, double z) {
        double r789323 = y;
        double r789324 = z;
        double r789325 = -r789324;
        double r789326 = x;
        double r789327 = fma(r789323, r789325, r789326);
        return r789327;
}

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. Taylor expanded around inf 0.0

    \[\leadsto \color{blue}{x - z \cdot y}\]
  3. Simplified0

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

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

Reproduce

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