Average Error: 0.2 → 0.0
Time: 20.3s
Precision: 64
\[\left(d1 \cdot 10 + d1 \cdot d2\right) + d1 \cdot 20\]
\[d2 \cdot d1 + 30 \cdot d1\]
\left(d1 \cdot 10 + d1 \cdot d2\right) + d1 \cdot 20
d2 \cdot d1 + 30 \cdot d1
double f(double d1, double d2) {
        double r8337629 = d1;
        double r8337630 = 10.0;
        double r8337631 = r8337629 * r8337630;
        double r8337632 = d2;
        double r8337633 = r8337629 * r8337632;
        double r8337634 = r8337631 + r8337633;
        double r8337635 = 20.0;
        double r8337636 = r8337629 * r8337635;
        double r8337637 = r8337634 + r8337636;
        return r8337637;
}

double f(double d1, double d2) {
        double r8337638 = d2;
        double r8337639 = d1;
        double r8337640 = r8337638 * r8337639;
        double r8337641 = 30.0;
        double r8337642 = r8337641 * r8337639;
        double r8337643 = r8337640 + r8337642;
        return r8337643;
}

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(d2 + 30\right)}\]
  3. Using strategy rm
  4. Applied distribute-rgt-in0.0

    \[\leadsto \color{blue}{d2 \cdot d1 + 30 \cdot d1}\]
  5. Final simplification0.0

    \[\leadsto d2 \cdot d1 + 30 \cdot d1\]

Reproduce

herbie shell --seed 2019133 
(FPCore (d1 d2)
  :name "FastMath test2"

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

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