Average Error: 0.2 → 0.0
Time: 6.5s
Precision: 64
\[\left(d1 \cdot 10 + d1 \cdot d2\right) + d1 \cdot 20\]
\[\left(20 + \left(10 + d2\right)\right) \cdot d1\]
\left(d1 \cdot 10 + d1 \cdot d2\right) + d1 \cdot 20
\left(20 + \left(10 + d2\right)\right) \cdot d1
double f(double d1, double d2) {
        double r219750 = d1;
        double r219751 = 10.0;
        double r219752 = r219750 * r219751;
        double r219753 = d2;
        double r219754 = r219750 * r219753;
        double r219755 = r219752 + r219754;
        double r219756 = 20.0;
        double r219757 = r219750 * r219756;
        double r219758 = r219755 + r219757;
        return r219758;
}

double f(double d1, double d2) {
        double r219759 = 20.0;
        double r219760 = 10.0;
        double r219761 = d2;
        double r219762 = r219760 + r219761;
        double r219763 = r219759 + r219762;
        double r219764 = d1;
        double r219765 = r219763 * r219764;
        return r219765;
}

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

    \[\leadsto d1 \cdot \color{blue}{{\left(d2 + \left(10 + 20\right)\right)}^{1}}\]
  5. Applied pow10.0

    \[\leadsto \color{blue}{{d1}^{1}} \cdot {\left(d2 + \left(10 + 20\right)\right)}^{1}\]
  6. Applied pow-prod-down0.0

    \[\leadsto \color{blue}{{\left(d1 \cdot \left(d2 + \left(10 + 20\right)\right)\right)}^{1}}\]
  7. Simplified0.0

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

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

Reproduce

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

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

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