Average Error: 0.2 → 0.0
Time: 29.2s
Precision: 64
\[\left(d1 \cdot 10.0 + d1 \cdot d2\right) + d1 \cdot 20.0\]
\[d1 \cdot d2 + \left(10.0 + 20.0\right) \cdot d1\]
\left(d1 \cdot 10.0 + d1 \cdot d2\right) + d1 \cdot 20.0
d1 \cdot d2 + \left(10.0 + 20.0\right) \cdot d1
double f(double d1, double d2) {
        double r8481787 = d1;
        double r8481788 = 10.0;
        double r8481789 = r8481787 * r8481788;
        double r8481790 = d2;
        double r8481791 = r8481787 * r8481790;
        double r8481792 = r8481789 + r8481791;
        double r8481793 = 20.0;
        double r8481794 = r8481787 * r8481793;
        double r8481795 = r8481792 + r8481794;
        return r8481795;
}

double f(double d1, double d2) {
        double r8481796 = d1;
        double r8481797 = d2;
        double r8481798 = r8481796 * r8481797;
        double r8481799 = 10.0;
        double r8481800 = 20.0;
        double r8481801 = r8481799 + r8481800;
        double r8481802 = r8481801 * r8481796;
        double r8481803 = r8481798 + r8481802;
        return r8481803;
}

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.0 + d2\right)\]

Derivation

  1. Initial program 0.2

    \[\left(d1 \cdot 10.0 + d1 \cdot d2\right) + d1 \cdot 20.0\]
  2. Simplified0.0

    \[\leadsto \color{blue}{d1 \cdot \left(d2 + \left(10.0 + 20.0\right)\right)}\]
  3. Using strategy rm
  4. Applied distribute-lft-in0.0

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

    \[\leadsto d1 \cdot d2 + \left(10.0 + 20.0\right) \cdot d1\]

Reproduce

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

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

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