Average Error: 45.1 → 45.1
Time: 2.5s
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 r66593 = x;
        double r66594 = y;
        double r66595 = z;
        double r66596 = fma(r66593, r66594, r66595);
        double r66597 = 1.0;
        double r66598 = r66593 * r66594;
        double r66599 = r66598 + r66595;
        double r66600 = r66597 + r66599;
        double r66601 = r66596 - r66600;
        return r66601;
}

double f(double x, double y, double z) {
        double r66602 = x;
        double r66603 = y;
        double r66604 = z;
        double r66605 = fma(r66602, r66603, r66604);
        double r66606 = 1.0;
        double r66607 = r66602 * r66603;
        double r66608 = r66607 + r66604;
        double r66609 = r66606 + r66608;
        double r66610 = r66605 - r66609;
        return r66610;
}

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

  :herbie-target
  -1

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