Average Error: 45.2 → 45.2
Time: 5.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 r59501 = x;
        double r59502 = y;
        double r59503 = z;
        double r59504 = fma(r59501, r59502, r59503);
        double r59505 = 1.0;
        double r59506 = r59501 * r59502;
        double r59507 = r59506 + r59503;
        double r59508 = r59505 + r59507;
        double r59509 = r59504 - r59508;
        return r59509;
}

double f(double x, double y, double z) {
        double r59510 = x;
        double r59511 = y;
        double r59512 = z;
        double r59513 = fma(r59510, r59511, r59512);
        double r59514 = 1.0;
        double r59515 = r59510 * r59511;
        double r59516 = r59515 + r59512;
        double r59517 = r59514 + r59516;
        double r59518 = r59513 - r59517;
        return r59518;
}

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

  :herbie-target
  -1

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