Average Error: 45.1 → 45.1
Time: 15.2s
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 r62143 = x;
        double r62144 = y;
        double r62145 = z;
        double r62146 = fma(r62143, r62144, r62145);
        double r62147 = 1.0;
        double r62148 = r62143 * r62144;
        double r62149 = r62148 + r62145;
        double r62150 = r62147 + r62149;
        double r62151 = r62146 - r62150;
        return r62151;
}

double f(double x, double y, double z) {
        double r62152 = x;
        double r62153 = y;
        double r62154 = z;
        double r62155 = fma(r62152, r62153, r62154);
        double r62156 = 1.0;
        double r62157 = r62152 * r62153;
        double r62158 = r62157 + r62154;
        double r62159 = r62156 + r62158;
        double r62160 = r62155 - r62159;
        return r62160;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Target

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

Derivation

  1. Initial program 45.1

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

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

Reproduce

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

  :herbie-target
  -1

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