Average Error: 45.4 → 45.4
Time: 8.0s
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 r79000 = x;
        double r79001 = y;
        double r79002 = z;
        double r79003 = fma(r79000, r79001, r79002);
        double r79004 = 1.0;
        double r79005 = r79000 * r79001;
        double r79006 = r79005 + r79002;
        double r79007 = r79004 + r79006;
        double r79008 = r79003 - r79007;
        return r79008;
}

double f(double x, double y, double z) {
        double r79009 = x;
        double r79010 = y;
        double r79011 = z;
        double r79012 = fma(r79009, r79010, r79011);
        double r79013 = 1.0;
        double r79014 = r79009 * r79010;
        double r79015 = r79014 + r79011;
        double r79016 = r79013 + r79015;
        double r79017 = r79012 - r79016;
        return r79017;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Target

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

Derivation

  1. Initial program 45.4

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

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

Reproduce

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

  :herbie-target
  -1

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