Average Error: 45.0 → 45.0
Time: 9.4s
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 r1893227 = x;
        double r1893228 = y;
        double r1893229 = z;
        double r1893230 = fma(r1893227, r1893228, r1893229);
        double r1893231 = 1.0;
        double r1893232 = r1893227 * r1893228;
        double r1893233 = r1893232 + r1893229;
        double r1893234 = r1893231 + r1893233;
        double r1893235 = r1893230 - r1893234;
        return r1893235;
}

double f(double x, double y, double z) {
        double r1893236 = x;
        double r1893237 = y;
        double r1893238 = z;
        double r1893239 = fma(r1893236, r1893237, r1893238);
        double r1893240 = r1893236 * r1893237;
        double r1893241 = r1893240 + r1893238;
        double r1893242 = 1.0;
        double r1893243 = r1893241 + r1893242;
        double r1893244 = r1893239 - r1893243;
        double r1893245 = /* ERROR: no posit support in C */;
        double r1893246 = /* ERROR: no posit support in C */;
        return r1893246;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Target

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

Derivation

  1. Initial program 45.0

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

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

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

  :herbie-target
  -1

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