Average Error: 45.6 → 45.6
Time: 9.0s
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 r1613528 = x;
        double r1613529 = y;
        double r1613530 = z;
        double r1613531 = fma(r1613528, r1613529, r1613530);
        double r1613532 = 1.0;
        double r1613533 = r1613528 * r1613529;
        double r1613534 = r1613533 + r1613530;
        double r1613535 = r1613532 + r1613534;
        double r1613536 = r1613531 - r1613535;
        return r1613536;
}

double f(double x, double y, double z) {
        double r1613537 = x;
        double r1613538 = y;
        double r1613539 = z;
        double r1613540 = fma(r1613537, r1613538, r1613539);
        double r1613541 = r1613537 * r1613538;
        double r1613542 = r1613541 + r1613539;
        double r1613543 = 1.0;
        double r1613544 = r1613542 + r1613543;
        double r1613545 = r1613540 - r1613544;
        double r1613546 = /* ERROR: no posit support in C */;
        double r1613547 = /* ERROR: no posit support in C */;
        return r1613547;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Target

Original45.6
Target0
Herbie45.6
\[-1\]

Derivation

  1. Initial program 45.6

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

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

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

  :herbie-target
  -1

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