Average Error: 45.0 → 45.0
Time: 2.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 r72694 = x;
        double r72695 = y;
        double r72696 = z;
        double r72697 = fma(r72694, r72695, r72696);
        double r72698 = 1.0;
        double r72699 = r72694 * r72695;
        double r72700 = r72699 + r72696;
        double r72701 = r72698 + r72700;
        double r72702 = r72697 - r72701;
        return r72702;
}

double f(double x, double y, double z) {
        double r72703 = x;
        double r72704 = y;
        double r72705 = z;
        double r72706 = fma(r72703, r72704, r72705);
        double r72707 = 1.0;
        double r72708 = r72703 * r72704;
        double r72709 = r72708 + r72705;
        double r72710 = r72707 + r72709;
        double r72711 = r72706 - r72710;
        return r72711;
}

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))))