Average Error: 45.1 → 45.1
Time: 8.3s
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 r52443 = x;
        double r52444 = y;
        double r52445 = z;
        double r52446 = fma(r52443, r52444, r52445);
        double r52447 = 1.0;
        double r52448 = r52443 * r52444;
        double r52449 = r52448 + r52445;
        double r52450 = r52447 + r52449;
        double r52451 = r52446 - r52450;
        return r52451;
}

double f(double x, double y, double z) {
        double r52452 = x;
        double r52453 = y;
        double r52454 = z;
        double r52455 = fma(r52452, r52453, r52454);
        double r52456 = 1.0;
        double r52457 = 1.0;
        double r52458 = r52452 * r52453;
        double r52459 = r52454 + r52458;
        double r52460 = r52457 / r52459;
        double r52461 = r52457 / r52460;
        double r52462 = r52456 + r52461;
        double r52463 = r52455 - r52462;
        return r52463;
}

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))))