Average Error: 45.2 → 45.2
Time: 1.9s
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 r70304 = x;
        double r70305 = y;
        double r70306 = z;
        double r70307 = fma(r70304, r70305, r70306);
        double r70308 = 1.0;
        double r70309 = r70304 * r70305;
        double r70310 = r70309 + r70306;
        double r70311 = r70308 + r70310;
        double r70312 = r70307 - r70311;
        return r70312;
}

double f(double x, double y, double z) {
        double r70313 = x;
        double r70314 = y;
        double r70315 = z;
        double r70316 = fma(r70313, r70314, r70315);
        double r70317 = 1.0;
        double r70318 = r70313 * r70314;
        double r70319 = r70318 + r70315;
        double r70320 = r70317 + r70319;
        double r70321 = r70316 - r70320;
        return r70321;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Target

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

Derivation

  1. Initial program 45.2

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

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

Reproduce

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

  :herbie-target
  -1

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