Average Error: 45.8 → 45.8
Time: 5.7s
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 r79911 = x;
        double r79912 = y;
        double r79913 = z;
        double r79914 = fma(r79911, r79912, r79913);
        double r79915 = 1.0;
        double r79916 = r79911 * r79912;
        double r79917 = r79916 + r79913;
        double r79918 = r79915 + r79917;
        double r79919 = r79914 - r79918;
        return r79919;
}

double f(double x, double y, double z) {
        double r79920 = x;
        double r79921 = y;
        double r79922 = z;
        double r79923 = fma(r79920, r79921, r79922);
        double r79924 = 1.0;
        double r79925 = r79920 * r79921;
        double r79926 = r79925 + r79922;
        double r79927 = r79924 + r79926;
        double r79928 = r79923 - r79927;
        return r79928;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Target

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

Derivation

  1. Initial program 45.8

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

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

Reproduce

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

  :herbie-target
  -1

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