Average Error: 0.0 → 0
Time: 4.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 r399923 = x;
        double r399924 = y;
        double r399925 = z;
        double r399926 = r399924 * r399925;
        double r399927 = r399923 - r399926;
        return r399927;
}

double f(double x, double y, double z) {
        double r399928 = y;
        double r399929 = z;
        double r399930 = -r399929;
        double r399931 = x;
        double r399932 = fma(r399928, r399930, r399931);
        return r399932;
}

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