Average Error: 45.1 → 45.1
Time: 7.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 r1011871 = x;
        double r1011872 = y;
        double r1011873 = z;
        double r1011874 = fma(r1011871, r1011872, r1011873);
        double r1011875 = 1.0;
        double r1011876 = r1011871 * r1011872;
        double r1011877 = r1011876 + r1011873;
        double r1011878 = r1011875 + r1011877;
        double r1011879 = r1011874 - r1011878;
        return r1011879;
}

double f(double x, double y, double z) {
        double r1011880 = x;
        double r1011881 = y;
        double r1011882 = z;
        double r1011883 = fma(r1011880, r1011881, r1011882);
        double r1011884 = r1011880 * r1011881;
        double r1011885 = r1011884 + r1011882;
        double r1011886 = 1.0;
        double r1011887 = r1011885 + r1011886;
        double r1011888 = r1011883 - r1011887;
        double r1011889 = /* ERROR: no posit support in C */;
        double r1011890 = /* ERROR: no posit support in C */;
        return r1011890;
}

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

  :herbie-target
  -1

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