Average Error: 44.8 → 8.0
Time: 35.9s
Precision: 64
\[(x \cdot y + z)_* - \left(1 + \left(x \cdot y + z\right)\right)\]
\[\left((x \cdot y + z)_* - \left(z + x \cdot y\right)\right) - 1\]
double f(double x, double y, double z) {
        double r7786447 = x;
        double r7786448 = y;
        double r7786449 = z;
        double r7786450 = fma(r7786447, r7786448, r7786449);
        double r7786451 = 1.0;
        double r7786452 = r7786447 * r7786448;
        double r7786453 = r7786452 + r7786449;
        double r7786454 = r7786451 + r7786453;
        double r7786455 = r7786450 - r7786454;
        return r7786455;
}

double f(double x, double y, double z) {
        double r7786456 = x;
        double r7786457 = y;
        double r7786458 = z;
        double r7786459 = fma(r7786456, r7786457, r7786458);
        double r7786460 = r7786456 * r7786457;
        double r7786461 = r7786458 + r7786460;
        double r7786462 = r7786459 - r7786461;
        double r7786463 = 1.0;
        double r7786464 = r7786462 - r7786463;
        return r7786464;
}

(x \cdot y + z)_* - \left(1 + \left(x \cdot y + z\right)\right)
\left((x \cdot y + z)_* - \left(z + x \cdot y\right)\right) - 1

Error

Bits error versus x

Bits error versus y

Bits error versus z

Target

Original44.8
Target0
Herbie8.0
\[-1\]

Derivation

  1. Initial program 44.8

    \[(x \cdot y + z)_* - \left(1 + \left(x \cdot y + z\right)\right)\]
  2. Using strategy rm
  3. Applied add-log-exp46.6

    \[\leadsto (x \cdot y + z)_* - \color{blue}{\log \left(e^{1 + \left(x \cdot y + z\right)}\right)}\]
  4. Applied add-log-exp47.1

    \[\leadsto \color{blue}{\log \left(e^{(x \cdot y + z)_*}\right)} - \log \left(e^{1 + \left(x \cdot y + z\right)}\right)\]
  5. Applied diff-log47.1

    \[\leadsto \color{blue}{\log \left(\frac{e^{(x \cdot y + z)_*}}{e^{1 + \left(x \cdot y + z\right)}}\right)}\]
  6. Simplified13.4

    \[\leadsto \log \color{blue}{\left(\frac{e^{\left((x \cdot y + z)_* - x \cdot y\right) - z}}{e}\right)}\]
  7. Using strategy rm
  8. Applied log-div13.4

    \[\leadsto \color{blue}{\log \left(e^{\left((x \cdot y + z)_* - x \cdot y\right) - z}\right) - \log e}\]
  9. Simplified8.0

    \[\leadsto \color{blue}{\left((x \cdot y + z)_* - \left(x \cdot y + z\right)\right)} - \log e\]
  10. Final simplification8.0

    \[\leadsto \left((x \cdot y + z)_* - \left(z + x \cdot y\right)\right) - 1\]

Reproduce

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

  :herbie-target
  -1

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