Average Error: 0.0 → 0.0
Time: 2.6s
Precision: 64
\[\left(\left(d1 \cdot d2 - d1 \cdot d3\right) + d4 \cdot d1\right) - d1 \cdot d1\]
\[d1 \cdot d2 + d1 \cdot \left(\left(-d3\right) + \left(d4 - d1\right)\right)\]
\left(\left(d1 \cdot d2 - d1 \cdot d3\right) + d4 \cdot d1\right) - d1 \cdot d1
d1 \cdot d2 + d1 \cdot \left(\left(-d3\right) + \left(d4 - d1\right)\right)
double f(double d1, double d2, double d3, double d4) {
        double r245899 = d1;
        double r245900 = d2;
        double r245901 = r245899 * r245900;
        double r245902 = d3;
        double r245903 = r245899 * r245902;
        double r245904 = r245901 - r245903;
        double r245905 = d4;
        double r245906 = r245905 * r245899;
        double r245907 = r245904 + r245906;
        double r245908 = r245899 * r245899;
        double r245909 = r245907 - r245908;
        return r245909;
}

double f(double d1, double d2, double d3, double d4) {
        double r245910 = d1;
        double r245911 = d2;
        double r245912 = r245910 * r245911;
        double r245913 = d3;
        double r245914 = -r245913;
        double r245915 = d4;
        double r245916 = r245915 - r245910;
        double r245917 = r245914 + r245916;
        double r245918 = r245910 * r245917;
        double r245919 = r245912 + r245918;
        return r245919;
}

Error

Bits error versus d1

Bits error versus d2

Bits error versus d3

Bits error versus d4

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original0.0
Target0.0
Herbie0.0
\[d1 \cdot \left(\left(\left(d2 - d3\right) + d4\right) - d1\right)\]

Derivation

  1. Initial program 0.0

    \[\left(\left(d1 \cdot d2 - d1 \cdot d3\right) + d4 \cdot d1\right) - d1 \cdot d1\]
  2. Simplified0.0

    \[\leadsto \color{blue}{d1 \cdot \left(\left(d2 - d3\right) + \left(d4 - d1\right)\right)}\]
  3. Using strategy rm
  4. Applied distribute-lft-in0.0

    \[\leadsto \color{blue}{d1 \cdot \left(d2 - d3\right) + d1 \cdot \left(d4 - d1\right)}\]
  5. Using strategy rm
  6. Applied sub-neg0.0

    \[\leadsto d1 \cdot \color{blue}{\left(d2 + \left(-d3\right)\right)} + d1 \cdot \left(d4 - d1\right)\]
  7. Applied distribute-lft-in0.0

    \[\leadsto \color{blue}{\left(d1 \cdot d2 + d1 \cdot \left(-d3\right)\right)} + d1 \cdot \left(d4 - d1\right)\]
  8. Applied associate-+l+0.0

    \[\leadsto \color{blue}{d1 \cdot d2 + \left(d1 \cdot \left(-d3\right) + d1 \cdot \left(d4 - d1\right)\right)}\]
  9. Simplified0.0

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

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

Reproduce

herbie shell --seed 2020056 
(FPCore (d1 d2 d3 d4)
  :name "FastMath dist4"
  :precision binary64

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

  (- (+ (- (* d1 d2) (* d1 d3)) (* d4 d1)) (* d1 d1)))