Average Error: 0.0 → 0
Time: 1.9s
Precision: 64
\[x - y \cdot z\]
\[\mathsf{fma}\left(-z, y, x\right)\]
x - y \cdot z
\mathsf{fma}\left(-z, y, x\right)
double f(double x, double y, double z) {
        double r664859 = x;
        double r664860 = y;
        double r664861 = z;
        double r664862 = r664860 * r664861;
        double r664863 = r664859 - r664862;
        return r664863;
}

double f(double x, double y, double z) {
        double r664864 = z;
        double r664865 = -r664864;
        double r664866 = y;
        double r664867 = x;
        double r664868 = fma(r664865, r664866, r664867);
        return r664868;
}

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(-z, y, x\right)}\]
  4. Final simplification0

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

Reproduce

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