Average Error: 44.9 → 44.9
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 r80467 = x;
        double r80468 = y;
        double r80469 = z;
        double r80470 = fma(r80467, r80468, r80469);
        double r80471 = 1.0;
        double r80472 = r80467 * r80468;
        double r80473 = r80472 + r80469;
        double r80474 = r80471 + r80473;
        double r80475 = r80470 - r80474;
        return r80475;
}

double f(double x, double y, double z) {
        double r80476 = x;
        double r80477 = y;
        double r80478 = z;
        double r80479 = fma(r80476, r80477, r80478);
        double r80480 = 1.0;
        double r80481 = r80476 * r80477;
        double r80482 = r80481 + r80478;
        double r80483 = r80480 + r80482;
        double r80484 = r80479 - r80483;
        return r80484;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Target

Original44.9
Target0
Herbie44.9
\[-1\]

Derivation

  1. Initial program 44.9

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

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

Reproduce

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

  :herbie-target
  -1

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