Average Error: 0.1 → 0.1
Time: 3.3s
Precision: 64
\[\left(d1 \cdot 3 + d1 \cdot d2\right) + d1 \cdot d3\]
\[1 \cdot \left(d1 \cdot d3 + d1 \cdot d2\right) + 3 \cdot d1\]
\left(d1 \cdot 3 + d1 \cdot d2\right) + d1 \cdot d3
1 \cdot \left(d1 \cdot d3 + d1 \cdot d2\right) + 3 \cdot d1
double f(double d1, double d2, double d3) {
        double r173806 = d1;
        double r173807 = 3.0;
        double r173808 = r173806 * r173807;
        double r173809 = d2;
        double r173810 = r173806 * r173809;
        double r173811 = r173808 + r173810;
        double r173812 = d3;
        double r173813 = r173806 * r173812;
        double r173814 = r173811 + r173813;
        return r173814;
}

double f(double d1, double d2, double d3) {
        double r173815 = 1.0;
        double r173816 = d1;
        double r173817 = d3;
        double r173818 = r173816 * r173817;
        double r173819 = d2;
        double r173820 = r173816 * r173819;
        double r173821 = r173818 + r173820;
        double r173822 = r173815 * r173821;
        double r173823 = 3.0;
        double r173824 = r173823 * r173816;
        double r173825 = r173822 + r173824;
        return r173825;
}

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}{d1 \cdot \left(\left(3 + d2\right) + d3\right)}\]
  3. Using strategy rm
  4. Applied flip-+21.5

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

    \[\leadsto \color{blue}{\frac{d1 \cdot \left(\left(3 + d2\right) \cdot \left(3 + d2\right) - d3 \cdot d3\right)}{\left(3 + d2\right) - d3}}\]
  6. Taylor expanded around 0 0.1

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

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

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

Reproduce

herbie shell --seed 2020100 
(FPCore (d1 d2 d3)
  :name "FastMath test3"
  :precision binary64

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

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