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 r1025322 = x;
        double r1025323 = y;
        double r1025324 = z;
        double r1025325 = fma(r1025322, r1025323, r1025324);
        double r1025326 = 1.0;
        double r1025327 = r1025322 * r1025323;
        double r1025328 = r1025327 + r1025324;
        double r1025329 = r1025326 + r1025328;
        double r1025330 = r1025325 - r1025329;
        return r1025330;
}

double f(double x, double y, double z) {
        double r1025331 = x;
        double r1025332 = y;
        double r1025333 = z;
        double r1025334 = fma(r1025331, r1025332, r1025333);
        double r1025335 = r1025331 * r1025332;
        double r1025336 = r1025335 + r1025333;
        double r1025337 = 1.0;
        double r1025338 = r1025336 + r1025337;
        double r1025339 = r1025334 - r1025338;
        double r1025340 = /* ERROR: no posit support in C */;
        double r1025341 = /* ERROR: no posit support in C */;
        return r1025341;
}

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