Average Error: 0.2 → 0.0
Time: 18.1s
Precision: 64
\[\left(d1 \cdot 10 + d1 \cdot d2\right) + d1 \cdot 20\]
\[1 \cdot \left(d2 \cdot d1\right) + 30 \cdot d1\]
\left(d1 \cdot 10 + d1 \cdot d2\right) + d1 \cdot 20
1 \cdot \left(d2 \cdot d1\right) + 30 \cdot d1
double f(double d1, double d2) {
        double r21131748 = d1;
        double r21131749 = 10.0;
        double r21131750 = r21131748 * r21131749;
        double r21131751 = d2;
        double r21131752 = r21131748 * r21131751;
        double r21131753 = r21131750 + r21131752;
        double r21131754 = 20.0;
        double r21131755 = r21131748 * r21131754;
        double r21131756 = r21131753 + r21131755;
        return r21131756;
}

double f(double d1, double d2) {
        double r21131757 = 1.0;
        double r21131758 = d2;
        double r21131759 = d1;
        double r21131760 = r21131758 * r21131759;
        double r21131761 = r21131757 * r21131760;
        double r21131762 = 30.0;
        double r21131763 = r21131762 * r21131759;
        double r21131764 = r21131761 + r21131763;
        return r21131764;
}

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 flip-+11.3

    \[\leadsto d1 \cdot \color{blue}{\frac{20 \cdot 20 - \left(10 + d2\right) \cdot \left(10 + d2\right)}{20 - \left(10 + d2\right)}}\]
  5. Applied associate-*r/13.7

    \[\leadsto \color{blue}{\frac{d1 \cdot \left(20 \cdot 20 - \left(10 + d2\right) \cdot \left(10 + d2\right)\right)}{20 - \left(10 + d2\right)}}\]
  6. Taylor expanded around 0 0.0

    \[\leadsto \color{blue}{1 \cdot \left(d2 \cdot d1\right) + 30 \cdot d1}\]
  7. Final simplification0.0

    \[\leadsto 1 \cdot \left(d2 \cdot d1\right) + 30 \cdot d1\]

Reproduce

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

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

  (+ (+ (* d1 10.0) (* d1 d2)) (* d1 20.0)))