Average Error: 44.9 → 44.9
Time: 9.1s
Precision: 64
\[\mathsf{fma}\left(x, y, z\right) - \left(1 + \left(x \cdot y + z\right)\right)\]
\[\mathsf{fma}\left(x, y, z\right) - \left(1 + \left(x \cdot y + z\right)\right)\]
\mathsf{fma}\left(x, y, z\right) - \left(1 + \left(x \cdot y + z\right)\right)
\mathsf{fma}\left(x, y, z\right) - \left(1 + \left(x \cdot y + z\right)\right)
double f(double x, double y, double z) {
        double r78849 = x;
        double r78850 = y;
        double r78851 = z;
        double r78852 = fma(r78849, r78850, r78851);
        double r78853 = 1.0;
        double r78854 = r78849 * r78850;
        double r78855 = r78854 + r78851;
        double r78856 = r78853 + r78855;
        double r78857 = r78852 - r78856;
        return r78857;
}

double f(double x, double y, double z) {
        double r78858 = x;
        double r78859 = y;
        double r78860 = z;
        double r78861 = fma(r78858, r78859, r78860);
        double r78862 = 1.0;
        double r78863 = r78858 * r78859;
        double r78864 = r78863 + r78860;
        double r78865 = r78862 + r78864;
        double r78866 = r78861 - r78865;
        return r78866;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Target

Original44.9
Target0
Herbie44.9
\[-1\]

Derivation

  1. Initial program 44.9

    \[\mathsf{fma}\left(x, y, z\right) - \left(1 + \left(x \cdot y + z\right)\right)\]
  2. Final simplification44.9

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

Reproduce

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

  :herbie-target
  -1

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