Average Error: 45.1 → 45.1
Time: 2.5s
Precision: 64
\[\mathsf{fma}\left(x, y, z\right) - \left(1 + \left(x \cdot y + z\right)\right)\]
\[\mathsf{fma}\left(x, y, z\right) - \left(1 + \left(x \cdot y + z\right)\right)\]
\mathsf{fma}\left(x, y, z\right) - \left(1 + \left(x \cdot y + z\right)\right)
\mathsf{fma}\left(x, y, z\right) - \left(1 + \left(x \cdot y + z\right)\right)
double f(double x, double y, double z) {
        double r38772 = x;
        double r38773 = y;
        double r38774 = z;
        double r38775 = fma(r38772, r38773, r38774);
        double r38776 = 1.0;
        double r38777 = r38772 * r38773;
        double r38778 = r38777 + r38774;
        double r38779 = r38776 + r38778;
        double r38780 = r38775 - r38779;
        return r38780;
}

double f(double x, double y, double z) {
        double r38781 = x;
        double r38782 = y;
        double r38783 = z;
        double r38784 = fma(r38781, r38782, r38783);
        double r38785 = 1.0;
        double r38786 = r38781 * r38782;
        double r38787 = r38786 + r38783;
        double r38788 = r38785 + r38787;
        double r38789 = r38784 - r38788;
        return r38789;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Target

Original45.1
Target0
Herbie45.1
\[-1\]

Derivation

  1. Initial program 45.1

    \[\mathsf{fma}\left(x, y, z\right) - \left(1 + \left(x \cdot y + z\right)\right)\]
  2. Final simplification45.1

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

Reproduce

herbie shell --seed 2020042 
(FPCore (x y z)
  :name "simple fma test"
  :precision binary64

  :herbie-target
  -1

  (- (fma x y z) (+ 1 (+ (* x y) z))))