Average Error: 45.1 → 45.1
Time: 6.1s
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 r9279 = x;
        double r9280 = y;
        double r9281 = z;
        double r9282 = fma(r9279, r9280, r9281);
        double r9283 = 1.0;
        double r9284 = r9279 * r9280;
        double r9285 = r9284 + r9281;
        double r9286 = r9283 + r9285;
        double r9287 = r9282 - r9286;
        return r9287;
}

double f(double x, double y, double z) {
        double r9288 = x;
        double r9289 = y;
        double r9290 = z;
        double r9291 = fma(r9288, r9289, r9290);
        double r9292 = 1.0;
        double r9293 = r9288 * r9289;
        double r9294 = r9293 + r9290;
        double r9295 = r9292 + r9294;
        double r9296 = r9291 - r9295;
        return r9296;
}

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 2019310 
(FPCore (x y z)
  :name "simple fma test"
  :precision binary64

  :herbie-target
  -1

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