Average Error: 0.2 → 0.0
Time: 12.0s
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 r11736505 = d1;
        double r11736506 = 10.0;
        double r11736507 = r11736505 * r11736506;
        double r11736508 = d2;
        double r11736509 = r11736505 * r11736508;
        double r11736510 = r11736507 + r11736509;
        double r11736511 = 20.0;
        double r11736512 = r11736505 * r11736511;
        double r11736513 = r11736510 + r11736512;
        return r11736513;
}

double f(double d1, double d2) {
        double r11736514 = d2;
        double r11736515 = 30.0;
        double r11736516 = r11736514 + r11736515;
        double r11736517 = d1;
        double r11736518 = r11736516 * r11736517;
        return r11736518;
}

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. Taylor expanded around 0 0.0

    \[\leadsto \color{blue}{d2 \cdot d1 + 30 \cdot d1}\]
  4. Simplified0.0

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

    \[\leadsto \left(d2 + 30\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)))