Average Error: 45.0 → 45.0
Time: 1.3s
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 r53511 = x;
        double r53512 = y;
        double r53513 = z;
        double r53514 = fma(r53511, r53512, r53513);
        double r53515 = 1.0;
        double r53516 = r53511 * r53512;
        double r53517 = r53516 + r53513;
        double r53518 = r53515 + r53517;
        double r53519 = r53514 - r53518;
        return r53519;
}

double f(double x, double y, double z) {
        double r53520 = x;
        double r53521 = y;
        double r53522 = z;
        double r53523 = fma(r53520, r53521, r53522);
        double r53524 = 1.0;
        double r53525 = r53520 * r53521;
        double r53526 = r53525 + r53522;
        double r53527 = r53524 + r53526;
        double r53528 = r53523 - r53527;
        return r53528;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Target

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

Derivation

  1. Initial program 45.0

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

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

Reproduce

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

  :herbie-target
  -1

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