Average Error: 0.1 → 0.1
Time: 13.2s
Precision: 64
\[\left(d1 \cdot 3 + d1 \cdot d2\right) + d1 \cdot d3\]
\[d1 \cdot 3 + \left(d3 + d2\right) \cdot d1\]
\left(d1 \cdot 3 + d1 \cdot d2\right) + d1 \cdot d3
d1 \cdot 3 + \left(d3 + d2\right) \cdot d1
double f(double d1, double d2, double d3) {
        double r7358700 = d1;
        double r7358701 = 3.0;
        double r7358702 = r7358700 * r7358701;
        double r7358703 = d2;
        double r7358704 = r7358700 * r7358703;
        double r7358705 = r7358702 + r7358704;
        double r7358706 = d3;
        double r7358707 = r7358700 * r7358706;
        double r7358708 = r7358705 + r7358707;
        return r7358708;
}

double f(double d1, double d2, double d3) {
        double r7358709 = d1;
        double r7358710 = 3.0;
        double r7358711 = r7358709 * r7358710;
        double r7358712 = d3;
        double r7358713 = d2;
        double r7358714 = r7358712 + r7358713;
        double r7358715 = r7358714 * r7358709;
        double r7358716 = r7358711 + r7358715;
        return r7358716;
}

Error

Bits error versus d1

Bits error versus d2

Bits error versus d3

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original0.1
Target0.1
Herbie0.1
\[d1 \cdot \left(\left(3 + d2\right) + d3\right)\]

Derivation

  1. Initial program 0.1

    \[\left(d1 \cdot 3 + d1 \cdot d2\right) + d1 \cdot d3\]
  2. Using strategy rm
  3. Applied associate-+l+0.1

    \[\leadsto \color{blue}{d1 \cdot 3 + \left(d1 \cdot d2 + d1 \cdot d3\right)}\]
  4. Simplified0.1

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

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

Reproduce

herbie shell --seed 2019149 
(FPCore (d1 d2 d3)
  :name "FastMath test3"

  :herbie-target
  (* d1 (+ (+ 3 d2) d3))

  (+ (+ (* d1 3) (* d1 d2)) (* d1 d3)))