Average Error: 0.1 → 0.1
Time: 1.2m
Precision: 64
\[\left(d1 \cdot 3 + d1 \cdot d2\right) + d1 \cdot d3\]
\[\left(\left(d3 + 3\right) + d2\right) \cdot d1\]
\left(d1 \cdot 3 + d1 \cdot d2\right) + d1 \cdot d3
\left(\left(d3 + 3\right) + d2\right) \cdot d1
double f(double d1, double d2, double d3) {
        double r53499365 = d1;
        double r53499366 = 3.0;
        double r53499367 = r53499365 * r53499366;
        double r53499368 = d2;
        double r53499369 = r53499365 * r53499368;
        double r53499370 = r53499367 + r53499369;
        double r53499371 = d3;
        double r53499372 = r53499365 * r53499371;
        double r53499373 = r53499370 + r53499372;
        return r53499373;
}

double f(double d1, double d2, double d3) {
        double r53499374 = d3;
        double r53499375 = 3.0;
        double r53499376 = r53499374 + r53499375;
        double r53499377 = d2;
        double r53499378 = r53499376 + r53499377;
        double r53499379 = d1;
        double r53499380 = r53499378 * r53499379;
        return r53499380;
}

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. Simplified0.1

    \[\leadsto \color{blue}{\left(\left(3 + d3\right) + d2\right) \cdot d1}\]
  3. Using strategy rm
  4. Applied *-un-lft-identity0.1

    \[\leadsto \left(\left(3 + d3\right) + d2\right) \cdot \color{blue}{\left(1 \cdot d1\right)}\]
  5. Applied associate-*r*0.1

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

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

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

Reproduce

herbie shell --seed 2019125 +o rules:numerics
(FPCore (d1 d2 d3)
  :name "FastMath test3"

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

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