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 r3364154 = x;
        double r3364155 = y;
        double r3364156 = z;
        double r3364157 = fma(r3364154, r3364155, r3364156);
        double r3364158 = 1.0;
        double r3364159 = r3364154 * r3364155;
        double r3364160 = r3364159 + r3364156;
        double r3364161 = r3364158 + r3364160;
        double r3364162 = r3364157 - r3364161;
        return r3364162;
}

double f(double x, double y, double z) {
        double r3364163 = x;
        double r3364164 = y;
        double r3364165 = z;
        double r3364166 = fma(r3364163, r3364164, r3364165);
        double r3364167 = r3364163 * r3364164;
        double r3364168 = r3364167 + r3364165;
        double r3364169 = 1.0;
        double r3364170 = r3364168 + r3364169;
        double r3364171 = r3364166 - r3364170;
        double r3364172 = /* ERROR: no posit support in C */;
        double r3364173 = /* ERROR: no posit support in C */;
        return r3364173;
}

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