Average Error: 0.2 → 0.0
Time: 7.4s
Precision: 64
\[\left(d1 \cdot 10 + d1 \cdot d2\right) + d1 \cdot 20\]
\[d1 \cdot \left(\left(20 + 10\right) + d2\right)\]
\left(d1 \cdot 10 + d1 \cdot d2\right) + d1 \cdot 20
d1 \cdot \left(\left(20 + 10\right) + d2\right)
double f(double d1, double d2) {
        double r236702 = d1;
        double r236703 = 10.0;
        double r236704 = r236702 * r236703;
        double r236705 = d2;
        double r236706 = r236702 * r236705;
        double r236707 = r236704 + r236706;
        double r236708 = 20.0;
        double r236709 = r236702 * r236708;
        double r236710 = r236707 + r236709;
        return r236710;
}

double f(double d1, double d2) {
        double r236711 = d1;
        double r236712 = 20.0;
        double r236713 = 10.0;
        double r236714 = r236712 + r236713;
        double r236715 = d2;
        double r236716 = r236714 + r236715;
        double r236717 = r236711 * r236716;
        return r236717;
}

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(20 + \left(10 + d2\right)\right)}\]
  3. Using strategy rm
  4. Applied associate-+r+0.0

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

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

Reproduce

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

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

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