Average Error: 45.4 → 45.4
Time: 5.2s
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 r74279 = x;
        double r74280 = y;
        double r74281 = z;
        double r74282 = fma(r74279, r74280, r74281);
        double r74283 = 1.0;
        double r74284 = r74279 * r74280;
        double r74285 = r74284 + r74281;
        double r74286 = r74283 + r74285;
        double r74287 = r74282 - r74286;
        return r74287;
}

double f(double x, double y, double z) {
        double r74288 = x;
        double r74289 = y;
        double r74290 = z;
        double r74291 = fma(r74288, r74289, r74290);
        double r74292 = 1.0;
        double r74293 = r74288 * r74289;
        double r74294 = r74293 + r74290;
        double r74295 = r74292 + r74294;
        double r74296 = r74291 - r74295;
        return r74296;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Target

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

Derivation

  1. Initial program 45.4

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

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

Reproduce

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

  :herbie-target
  -1

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