Average Error: 45.0 → 15.0
Time: 44.9s
Precision: 64
\[\mathsf{fma}\left(x, y, z\right) - \left(1.0 + \left(x \cdot y + z\right)\right)\]
\[\left(\left(\left(\left(\left(\left(\mathsf{fma}\left(x, y, z\right) - z\right) - x \cdot y\right) - 1.0\right)\right)\right)\right)\]
\mathsf{fma}\left(x, y, z\right) - \left(1.0 + \left(x \cdot y + z\right)\right)
\left(\left(\left(\left(\left(\left(\mathsf{fma}\left(x, y, z\right) - z\right) - x \cdot y\right) - 1.0\right)\right)\right)\right)
double f(double x, double y, double z) {
        double r3851916 = x;
        double r3851917 = y;
        double r3851918 = z;
        double r3851919 = fma(r3851916, r3851917, r3851918);
        double r3851920 = 1.0;
        double r3851921 = r3851916 * r3851917;
        double r3851922 = r3851921 + r3851918;
        double r3851923 = r3851920 + r3851922;
        double r3851924 = r3851919 - r3851923;
        return r3851924;
}

double f(double x, double y, double z) {
        double r3851925 = x;
        double r3851926 = y;
        double r3851927 = z;
        double r3851928 = fma(r3851925, r3851926, r3851927);
        double r3851929 = r3851928 - r3851927;
        double r3851930 = r3851925 * r3851926;
        double r3851931 = r3851929 - r3851930;
        double r3851932 = 1.0;
        double r3851933 = r3851931 - r3851932;
        double r3851934 = /* ERROR: no posit support in C */;
        double r3851935 = /* ERROR: no posit support in C */;
        double r3851936 = /* ERROR: no posit support in C */;
        double r3851937 = /* ERROR: no posit support in C */;
        return r3851937;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Target

Original45.0
Target0
Herbie15.0
\[-1.0\]

Derivation

  1. Initial program 45.0

    \[\mathsf{fma}\left(x, y, z\right) - \left(1.0 + \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.0 + \left(x \cdot y + z\right)\right)\right)\right)}\]
  4. Using strategy rm
  5. Applied add-cube-cbrt44.3

    \[\leadsto \left(\left(\mathsf{fma}\left(x, y, z\right) - \left(1.0 + \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.3

    \[\leadsto \left(\color{blue}{\left(\left(\left(\mathsf{fma}\left(x, y, z\right) - \left(1.0 + \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. Simplified30.7

    \[\leadsto \left(\left(\color{blue}{\left(\left(\left(\mathsf{fma}\left(x, y, z\right) - z\right) - \left(x \cdot y + 1.0\right)\right)\right)}\right)\right)\]
  9. Using strategy rm
  10. Applied associate--r+15.0

    \[\leadsto \left(\left(\left(\color{blue}{\left(\left(\left(\mathsf{fma}\left(x, y, z\right) - z\right) - x \cdot y\right) - 1.0\right)}\right)\right)\right)\]
  11. Final simplification15.0

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

Reproduce

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

  :herbie-target
  -1.0

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