Average Error: 0.2 → 0.0
Time: 11.0s
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 r7741551 = d1;
        double r7741552 = 10.0;
        double r7741553 = r7741551 * r7741552;
        double r7741554 = d2;
        double r7741555 = r7741551 * r7741554;
        double r7741556 = r7741553 + r7741555;
        double r7741557 = 20.0;
        double r7741558 = r7741551 * r7741557;
        double r7741559 = r7741556 + r7741558;
        return r7741559;
}

double f(double d1, double d2) {
        double r7741560 = 20.0;
        double r7741561 = 10.0;
        double r7741562 = d2;
        double r7741563 = r7741561 + r7741562;
        double r7741564 = r7741560 + r7741563;
        double r7741565 = d1;
        double r7741566 = r7741564 * r7741565;
        return r7741566;
}

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}{\left(\left(10 + 20\right) + d2\right) \cdot d1}\]
  3. Using strategy rm
  4. Applied add-sqr-sqrt13.6

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

    \[\leadsto \color{blue}{\sqrt{\left(10 + 20\right) + d2} \cdot \left(\sqrt{\left(10 + 20\right) + d2} \cdot d1\right)}\]
  6. Using strategy rm
  7. Applied associate-*r*13.6

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

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

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

Reproduce

herbie shell --seed 2019171 +o rules:numerics
(FPCore (d1 d2)
  :name "FastMath test2"

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

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