Average Error: 45.1 → 45.1
Time: 13.8s
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 r3145526 = x;
        double r3145527 = y;
        double r3145528 = z;
        double r3145529 = fma(r3145526, r3145527, r3145528);
        double r3145530 = 1.0;
        double r3145531 = r3145526 * r3145527;
        double r3145532 = r3145531 + r3145528;
        double r3145533 = r3145530 + r3145532;
        double r3145534 = r3145529 - r3145533;
        return r3145534;
}

double f(double x, double y, double z) {
        double r3145535 = x;
        double r3145536 = y;
        double r3145537 = z;
        double r3145538 = fma(r3145535, r3145536, r3145537);
        double r3145539 = r3145535 * r3145536;
        double r3145540 = r3145539 + r3145537;
        double r3145541 = 1.0;
        double r3145542 = r3145540 + r3145541;
        double r3145543 = r3145538 - r3145542;
        double r3145544 = /* ERROR: no posit support in C */;
        double r3145545 = /* ERROR: no posit support in C */;
        return r3145545;
}

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

  :herbie-target
  -1

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