Average Error: 45.1 → 45.1
Time: 13.1s
Precision: 64
\[\mathsf{fma}\left(x, y, z\right) - \left(1 + \left(x \cdot y + z\right)\right)\]
\[\left(\left(\mathsf{fma}\left(x, y, z\right) - \left(\left(x \cdot y + z\right) + 1\right)\right)\right)\]
\mathsf{fma}\left(x, y, z\right) - \left(1 + \left(x \cdot y + z\right)\right)
\left(\left(\mathsf{fma}\left(x, y, z\right) - \left(\left(x \cdot y + z\right) + 1\right)\right)\right)
double f(double x, double y, double z) {
        double r2396636 = x;
        double r2396637 = y;
        double r2396638 = z;
        double r2396639 = fma(r2396636, r2396637, r2396638);
        double r2396640 = 1.0;
        double r2396641 = r2396636 * r2396637;
        double r2396642 = r2396641 + r2396638;
        double r2396643 = r2396640 + r2396642;
        double r2396644 = r2396639 - r2396643;
        return r2396644;
}

double f(double x, double y, double z) {
        double r2396645 = x;
        double r2396646 = y;
        double r2396647 = z;
        double r2396648 = fma(r2396645, r2396646, r2396647);
        double r2396649 = r2396645 * r2396646;
        double r2396650 = r2396649 + r2396647;
        double r2396651 = 1.0;
        double r2396652 = r2396650 + r2396651;
        double r2396653 = r2396648 - r2396652;
        double r2396654 = /* ERROR: no posit support in C */;
        double r2396655 = /* ERROR: no posit support in C */;
        return r2396655;
}

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. Using strategy rm
  3. Applied insert-posit1645.1

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

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

Reproduce

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

  :herbie-target
  -1

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