Average Error: 45.3 → 7.9
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 r2345929 = x;
        double r2345930 = y;
        double r2345931 = z;
        double r2345932 = fma(r2345929, r2345930, r2345931);
        double r2345933 = 1.0;
        double r2345934 = r2345929 * r2345930;
        double r2345935 = r2345934 + r2345931;
        double r2345936 = r2345933 + r2345935;
        double r2345937 = r2345932 - r2345936;
        return r2345937;
}

double f(double x, double y, double z) {
        double r2345938 = -1.0;
        double r2345939 = x;
        double r2345940 = y;
        double r2345941 = z;
        double r2345942 = fma(r2345939, r2345940, r2345941);
        double r2345943 = r2345940 * r2345939;
        double r2345944 = r2345941 + r2345943;
        double r2345945 = r2345942 - r2345944;
        double r2345946 = r2345938 + r2345945;
        double r2345947 = /* ERROR: no posit support in C */;
        double r2345948 = /* ERROR: no posit support in C */;
        return r2345948;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Target

Original45.3
Target0
Herbie7.9
\[-1\]

Derivation

  1. Initial program 45.3

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

    \[\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-cbrt44.5

    \[\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-posit1644.5

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

    \[\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 7.9

    \[\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 simplification7.9

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

  :herbie-target
  -1

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