Average Error: 0.1 → 0.1
Time: 10.9s
Precision: 64
\[\left(d1 \cdot 3 + d1 \cdot d2\right) + d1 \cdot d3\]
\[\left(3 + \left(d3 + d2\right)\right) \cdot d1\]
\left(d1 \cdot 3 + d1 \cdot d2\right) + d1 \cdot d3
\left(3 + \left(d3 + d2\right)\right) \cdot d1
double f(double d1, double d2, double d3) {
        double r8174000 = d1;
        double r8174001 = 3.0;
        double r8174002 = r8174000 * r8174001;
        double r8174003 = d2;
        double r8174004 = r8174000 * r8174003;
        double r8174005 = r8174002 + r8174004;
        double r8174006 = d3;
        double r8174007 = r8174000 * r8174006;
        double r8174008 = r8174005 + r8174007;
        return r8174008;
}

double f(double d1, double d2, double d3) {
        double r8174009 = 3.0;
        double r8174010 = d3;
        double r8174011 = d2;
        double r8174012 = r8174010 + r8174011;
        double r8174013 = r8174009 + r8174012;
        double r8174014 = d1;
        double r8174015 = r8174013 * r8174014;
        return r8174015;
}

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(d2 + \left(3 + d3\right)\right) \cdot d1}\]
  3. Using strategy rm
  4. Applied *-un-lft-identity0.1

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

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

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

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

Reproduce

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

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

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