Average Error: 0.2 → 0.0
Time: 14.3s
Precision: 64
\[\left(d1 \cdot 10 + d1 \cdot d2\right) + d1 \cdot 20\]
\[d1 \cdot \left(10 + \left(d2 + 20\right)\right)\]
\left(d1 \cdot 10 + d1 \cdot d2\right) + d1 \cdot 20
d1 \cdot \left(10 + \left(d2 + 20\right)\right)
double f(double d1, double d2) {
        double r160849 = d1;
        double r160850 = 10.0;
        double r160851 = r160849 * r160850;
        double r160852 = d2;
        double r160853 = r160849 * r160852;
        double r160854 = r160851 + r160853;
        double r160855 = 20.0;
        double r160856 = r160849 * r160855;
        double r160857 = r160854 + r160856;
        return r160857;
}

double f(double d1, double d2) {
        double r160858 = d1;
        double r160859 = 10.0;
        double r160860 = d2;
        double r160861 = 20.0;
        double r160862 = r160860 + r160861;
        double r160863 = r160859 + r160862;
        double r160864 = r160858 * r160863;
        return r160864;
}

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

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

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

Reproduce

herbie shell --seed 2019326 
(FPCore (d1 d2)
  :name "FastMath test2"
  :precision binary64

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

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