Average Error: 45.8 → 8.1
Time: 21.6s
Precision: 64
\[\mathsf{fma}\left(x, y, z\right) - \left(1 + \left(x \cdot y + z\right)\right)\]
\[\left(\left(-1 + \left(\mathsf{fma}\left(x, y, z\right) - \left(z + y \cdot x\right)\right)\right)\right)\]
\mathsf{fma}\left(x, y, z\right) - \left(1 + \left(x \cdot y + z\right)\right)
\left(\left(-1 + \left(\mathsf{fma}\left(x, y, z\right) - \left(z + y \cdot x\right)\right)\right)\right)
double f(double x, double y, double z) {
        double r2536243 = x;
        double r2536244 = y;
        double r2536245 = z;
        double r2536246 = fma(r2536243, r2536244, r2536245);
        double r2536247 = 1.0;
        double r2536248 = r2536243 * r2536244;
        double r2536249 = r2536248 + r2536245;
        double r2536250 = r2536247 + r2536249;
        double r2536251 = r2536246 - r2536250;
        return r2536251;
}

double f(double x, double y, double z) {
        double r2536252 = -1.0;
        double r2536253 = x;
        double r2536254 = y;
        double r2536255 = z;
        double r2536256 = fma(r2536253, r2536254, r2536255);
        double r2536257 = r2536254 * r2536253;
        double r2536258 = r2536255 + r2536257;
        double r2536259 = r2536256 - r2536258;
        double r2536260 = r2536252 + r2536259;
        double r2536261 = /* ERROR: no posit support in C */;
        double r2536262 = /* ERROR: no posit support in C */;
        return r2536262;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Target

Original45.8
Target0
Herbie8.1
\[-1\]

Derivation

  1. Initial program 45.8

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

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

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

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

    \[\leadsto \color{blue}{\left(\left(-1 + \left(\left(\mathsf{fma}\left(x, y, z\right) - z\right) - x \cdot y\right)\right)\right)}\]
  9. Taylor expanded around inf 8.1

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

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

Reproduce

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

  :herbie-target
  -1

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