Average Error: 0.2 → 0.0
Time: 1.6s
Precision: 64
\[\left(d1 \cdot 10 + d1 \cdot d2\right) + d1 \cdot 20\]
\[\left(\left(10 + d2\right) + 20\right) \cdot d1\]
\left(d1 \cdot 10 + d1 \cdot d2\right) + d1 \cdot 20
\left(\left(10 + d2\right) + 20\right) \cdot d1
double f(double d1, double d2) {
        double r233524 = d1;
        double r233525 = 10.0;
        double r233526 = r233524 * r233525;
        double r233527 = d2;
        double r233528 = r233524 * r233527;
        double r233529 = r233526 + r233528;
        double r233530 = 20.0;
        double r233531 = r233524 * r233530;
        double r233532 = r233529 + r233531;
        return r233532;
}

double f(double d1, double d2) {
        double r233533 = 10.0;
        double r233534 = d2;
        double r233535 = r233533 + r233534;
        double r233536 = 20.0;
        double r233537 = r233535 + r233536;
        double r233538 = d1;
        double r233539 = r233537 * r233538;
        return r233539;
}

Error

Bits error versus d1

Bits error versus d2

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

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

Derivation

  1. Initial program 0.2

    \[\left(d1 \cdot 10 + d1 \cdot d2\right) + d1 \cdot 20\]
  2. Simplified0.0

    \[\leadsto \color{blue}{d1 \cdot \left(\left(10 + d2\right) + 20\right)}\]
  3. Using strategy rm
  4. Applied *-commutative0.0

    \[\leadsto \color{blue}{\left(\left(10 + d2\right) + 20\right) \cdot d1}\]
  5. Final simplification0.0

    \[\leadsto \left(\left(10 + d2\right) + 20\right) \cdot d1\]

Reproduce

herbie shell --seed 2020056 
(FPCore (d1 d2)
  :name "FastMath test2"
  :precision binary64

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

  (+ (+ (* d1 10) (* d1 d2)) (* d1 20)))