Average Error: 0.2 → 0.0
Time: 15.1s
Precision: 64
\[\left(d1 \cdot 10 + d1 \cdot d2\right) + d1 \cdot 20\]
\[\left(d2 + 30\right) \cdot d1\]
\left(d1 \cdot 10 + d1 \cdot d2\right) + d1 \cdot 20
\left(d2 + 30\right) \cdot d1
double f(double d1, double d2) {
        double r9054863 = d1;
        double r9054864 = 10.0;
        double r9054865 = r9054863 * r9054864;
        double r9054866 = d2;
        double r9054867 = r9054863 * r9054866;
        double r9054868 = r9054865 + r9054867;
        double r9054869 = 20.0;
        double r9054870 = r9054863 * r9054869;
        double r9054871 = r9054868 + r9054870;
        return r9054871;
}

double f(double d1, double d2) {
        double r9054872 = d2;
        double r9054873 = 30.0;
        double r9054874 = r9054872 + r9054873;
        double r9054875 = d1;
        double r9054876 = r9054874 * r9054875;
        return r9054876;
}

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

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

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

Reproduce

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

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

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