Average Error: 45.5 → 45.4
Time: 12.6s
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 r2350651 = x;
        double r2350652 = y;
        double r2350653 = z;
        double r2350654 = fma(r2350651, r2350652, r2350653);
        double r2350655 = 1.0;
        double r2350656 = r2350651 * r2350652;
        double r2350657 = r2350656 + r2350653;
        double r2350658 = r2350655 + r2350657;
        double r2350659 = r2350654 - r2350658;
        return r2350659;
}

double f(double x, double y, double z) {
        double r2350660 = x;
        double r2350661 = y;
        double r2350662 = z;
        double r2350663 = fma(r2350660, r2350661, r2350662);
        double r2350664 = r2350660 * r2350661;
        double r2350665 = r2350664 + r2350662;
        double r2350666 = 1.0;
        double r2350667 = r2350665 + r2350666;
        double r2350668 = r2350663 - r2350667;
        double r2350669 = /* ERROR: no posit support in C */;
        double r2350670 = /* ERROR: no posit support in C */;
        return r2350670;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Target

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

Derivation

  1. Initial program 45.5

    \[\mathsf{fma}\left(x, y, z\right) - \left(1 + \left(x \cdot y + z\right)\right)\]
  2. Using strategy rm
  3. Applied insert-posit1645.4

    \[\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.4

    \[\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 2019163 
(FPCore (x y z)
  :name "simple fma test"

  :herbie-target
  -1

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