Average Error: 45.1 → 45.1
Time: 12.8s
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 + \frac{1}{\frac{1}{z + x \cdot y}}\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 + \frac{1}{\frac{1}{z + x \cdot y}}\right)
double f(double x, double y, double z) {
        double r90885 = x;
        double r90886 = y;
        double r90887 = z;
        double r90888 = fma(r90885, r90886, r90887);
        double r90889 = 1.0;
        double r90890 = r90885 * r90886;
        double r90891 = r90890 + r90887;
        double r90892 = r90889 + r90891;
        double r90893 = r90888 - r90892;
        return r90893;
}

double f(double x, double y, double z) {
        double r90894 = x;
        double r90895 = y;
        double r90896 = z;
        double r90897 = fma(r90894, r90895, r90896);
        double r90898 = 1.0;
        double r90899 = 1.0;
        double r90900 = r90894 * r90895;
        double r90901 = r90896 + r90900;
        double r90902 = r90899 / r90901;
        double r90903 = r90899 / r90902;
        double r90904 = r90898 + r90903;
        double r90905 = r90897 - r90904;
        return r90905;
}

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. Using strategy rm
  3. Applied flip-+45.8

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

    \[\leadsto \mathsf{fma}\left(x, y, z\right) - \left(1 + \color{blue}{\frac{1}{\frac{x \cdot y - z}{\left(x \cdot y\right) \cdot \left(x \cdot y\right) - z \cdot z}}}\right)\]
  6. Simplified45.1

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

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

Reproduce

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

  :herbie-target
  -1

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