Average Error: 44.7 → 30.3
Time: 17.9s
Precision: 64
\[\mathsf{fma}\left(x, y, z\right) - \left(1 + \left(x \cdot y + z\right)\right)\]
\[\left(\left(\left(\left(\left(\left(\mathsf{fma}\left(x, y, z\right) - z\right)\right) - \left(1 + x \cdot y\right)\right)\right)\right)\right)\]
\mathsf{fma}\left(x, y, z\right) - \left(1 + \left(x \cdot y + z\right)\right)
\left(\left(\left(\left(\left(\left(\mathsf{fma}\left(x, y, z\right) - z\right)\right) - \left(1 + x \cdot y\right)\right)\right)\right)\right)
double f(double x, double y, double z) {
        double r1119213 = x;
        double r1119214 = y;
        double r1119215 = z;
        double r1119216 = fma(r1119213, r1119214, r1119215);
        double r1119217 = 1.0;
        double r1119218 = r1119213 * r1119214;
        double r1119219 = r1119218 + r1119215;
        double r1119220 = r1119217 + r1119219;
        double r1119221 = r1119216 - r1119220;
        return r1119221;
}

double f(double x, double y, double z) {
        double r1119222 = x;
        double r1119223 = y;
        double r1119224 = z;
        double r1119225 = fma(r1119222, r1119223, r1119224);
        double r1119226 = r1119225 - r1119224;
        double r1119227 = /* ERROR: no posit support in C */;
        double r1119228 = /* ERROR: no posit support in C */;
        double r1119229 = 1.0;
        double r1119230 = r1119222 * r1119223;
        double r1119231 = r1119229 + r1119230;
        double r1119232 = r1119228 - r1119231;
        double r1119233 = /* ERROR: no posit support in C */;
        double r1119234 = /* ERROR: no posit support in C */;
        double r1119235 = /* ERROR: no posit support in C */;
        double r1119236 = /* ERROR: no posit support in C */;
        return r1119236;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Target

Original44.7
Target0
Herbie30.3
\[-1\]

Derivation

  1. Initial program 44.7

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

    \[\leadsto \color{blue}{\left(\left(\mathsf{fma}\left(x, y, z\right) - \left(1 + \left(x \cdot y + z\right)\right)\right)\right)}\]
  4. Using strategy rm
  5. Applied add-cube-cbrt43.9

    \[\leadsto \left(\left(\mathsf{fma}\left(x, y, z\right) - \color{blue}{\left(\sqrt[3]{1 + \left(x \cdot y + z\right)} \cdot \sqrt[3]{1 + \left(x \cdot y + z\right)}\right) \cdot \sqrt[3]{1 + \left(x \cdot y + z\right)}}\right)\right)\]
  6. Using strategy rm
  7. Applied insert-posit1643.9

    \[\leadsto \left(\color{blue}{\left(\left(\left(\mathsf{fma}\left(x, y, z\right) - \left(\sqrt[3]{1 + \left(x \cdot y + z\right)} \cdot \sqrt[3]{1 + \left(x \cdot y + z\right)}\right) \cdot \sqrt[3]{1 + \left(x \cdot y + z\right)}\right)\right)\right)}\right)\]
  8. Simplified30.0

    \[\leadsto \left(\left(\color{blue}{\left(\left(\left(\mathsf{fma}\left(x, y, z\right) - z\right) - \left(1 + y \cdot x\right)\right)\right)}\right)\right)\]
  9. Using strategy rm
  10. Applied insert-posit1630.3

    \[\leadsto \left(\left(\left(\left(\color{blue}{\left(\left(\mathsf{fma}\left(x, y, z\right) - z\right)\right)} - \left(1 + y \cdot x\right)\right)\right)\right)\right)\]
  11. Final simplification30.3

    \[\leadsto \left(\left(\left(\left(\left(\left(\mathsf{fma}\left(x, y, z\right) - z\right)\right) - \left(1 + x \cdot y\right)\right)\right)\right)\right)\]

Reproduce

herbie shell --seed 2019154 
(FPCore (x y z)
  :name "simple fma test"

  :herbie-target
  -1

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