Average Error: 0.0 → 0.0
Time: 1.9s
Precision: 64
\[d1 \cdot d2 + d1 \cdot d3\]
\[(d1 \cdot d2 + \left(d1 \cdot d3\right))_*\]
d1 \cdot d2 + d1 \cdot d3
(d1 \cdot d2 + \left(d1 \cdot d3\right))_*
double f(double d1, double d2, double d3) {
        double r36999603 = d1;
        double r36999604 = d2;
        double r36999605 = r36999603 * r36999604;
        double r36999606 = d3;
        double r36999607 = r36999603 * r36999606;
        double r36999608 = r36999605 + r36999607;
        return r36999608;
}

double f(double d1, double d2, double d3) {
        double r36999609 = d1;
        double r36999610 = d2;
        double r36999611 = d3;
        double r36999612 = r36999609 * r36999611;
        double r36999613 = fma(r36999609, r36999610, r36999612);
        return r36999613;
}

Error

Bits error versus d1

Bits error versus d2

Bits error versus d3

Target

Original0.0
Target0.0
Herbie0.0
\[d1 \cdot \left(d2 + d3\right)\]

Derivation

  1. Initial program 0.0

    \[d1 \cdot d2 + d1 \cdot d3\]
  2. Using strategy rm
  3. Applied fma-def0.0

    \[\leadsto \color{blue}{(d1 \cdot d2 + \left(d1 \cdot d3\right))_*}\]
  4. Final simplification0.0

    \[\leadsto (d1 \cdot d2 + \left(d1 \cdot d3\right))_*\]

Reproduce

herbie shell --seed 2019112 +o rules:numerics
(FPCore (d1 d2 d3)
  :name "FastMath dist"

  :herbie-target
  (* d1 (+ d2 d3))

  (+ (* d1 d2) (* d1 d3)))