Average Error: 45.2 → 45.2
Time: 14.4s
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 r59830 = x;
        double r59831 = y;
        double r59832 = z;
        double r59833 = fma(r59830, r59831, r59832);
        double r59834 = 1.0;
        double r59835 = r59830 * r59831;
        double r59836 = r59835 + r59832;
        double r59837 = r59834 + r59836;
        double r59838 = r59833 - r59837;
        return r59838;
}

double f(double x, double y, double z) {
        double r59839 = x;
        double r59840 = y;
        double r59841 = z;
        double r59842 = fma(r59839, r59840, r59841);
        double r59843 = 1.0;
        double r59844 = r59839 * r59840;
        double r59845 = r59844 + r59841;
        double r59846 = r59843 + r59845;
        double r59847 = r59842 - r59846;
        return r59847;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Target

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

Derivation

  1. Initial program 45.2

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

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

Reproduce

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

  :herbie-target
  -1

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