Average Error: 44.4 → 7.8
Time: 23.9s
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(z + x \cdot y\right)\right)\right) - 1\]
\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(z + x \cdot y\right)\right)\right) - 1
double f(double x, double y, double z) {
        double r3939797 = x;
        double r3939798 = y;
        double r3939799 = z;
        double r3939800 = fma(r3939797, r3939798, r3939799);
        double r3939801 = 1.0;
        double r3939802 = r3939797 * r3939798;
        double r3939803 = r3939802 + r3939799;
        double r3939804 = r3939801 + r3939803;
        double r3939805 = r3939800 - r3939804;
        return r3939805;
}

double f(double x, double y, double z) {
        double r3939806 = x;
        double r3939807 = y;
        double r3939808 = z;
        double r3939809 = fma(r3939806, r3939807, r3939808);
        double r3939810 = r3939806 * r3939807;
        double r3939811 = r3939808 + r3939810;
        double r3939812 = r3939809 - r3939811;
        double r3939813 = /* ERROR: no posit support in C */;
        double r3939814 = /* ERROR: no posit support in C */;
        double r3939815 = 1.0;
        double r3939816 = r3939814 - r3939815;
        return r3939816;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Target

Original44.4
Target0
Herbie7.8
\[-1\]

Derivation

  1. Initial program 44.4

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

    \[\leadsto \mathsf{fma}\left(x, y, z\right) - \color{blue}{\left(\left(x \cdot y + z\right) + 1\right)}\]
  4. Applied associate--r+7.7

    \[\leadsto \color{blue}{\left(\mathsf{fma}\left(x, y, z\right) - \left(x \cdot y + z\right)\right) - 1}\]
  5. Using strategy rm
  6. Applied insert-posit167.8

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

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

Reproduce

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

  :herbie-target
  -1

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