Average Error: 0.2 → 0.0
Time: 2.8s
Precision: 64
\[\left(d1 \cdot 10 + d1 \cdot d2\right) + d1 \cdot 20\]
\[d1 \cdot \left(10 + \left(d2 + 20\right)\right)\]
\left(d1 \cdot 10 + d1 \cdot d2\right) + d1 \cdot 20
d1 \cdot \left(10 + \left(d2 + 20\right)\right)
double f(double d1, double d2) {
        double r508562 = d1;
        double r508563 = 10.0;
        double r508564 = r508562 * r508563;
        double r508565 = d2;
        double r508566 = r508562 * r508565;
        double r508567 = r508564 + r508566;
        double r508568 = 20.0;
        double r508569 = r508562 * r508568;
        double r508570 = r508567 + r508569;
        return r508570;
}

double f(double d1, double d2) {
        double r508571 = d1;
        double r508572 = 10.0;
        double r508573 = d2;
        double r508574 = 20.0;
        double r508575 = r508573 + r508574;
        double r508576 = r508572 + r508575;
        double r508577 = r508571 * r508576;
        return r508577;
}

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 associate-+l+0.0

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

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

Reproduce

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

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

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