Average Error: 26.7 → 7.4
Time: 7.1s
Precision: 64
\[\frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{\left(x + t\right) + y}\]
\[\begin{array}{l} \mathbf{if}\;\frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{\left(x + t\right) + y} = -\infty \lor \neg \left(\frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{\left(x + t\right) + y} \le 8.8061629631279907 \cdot 10^{244}\right):\\ \;\;\;\;\left(a + z\right) - b\\ \mathbf{else}:\\ \;\;\;\;1 \cdot \frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{\left(x + t\right) + y}\\ \end{array}\]
\frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{\left(x + t\right) + y}
\begin{array}{l}
\mathbf{if}\;\frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{\left(x + t\right) + y} = -\infty \lor \neg \left(\frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{\left(x + t\right) + y} \le 8.8061629631279907 \cdot 10^{244}\right):\\
\;\;\;\;\left(a + z\right) - b\\

\mathbf{else}:\\
\;\;\;\;1 \cdot \frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{\left(x + t\right) + y}\\

\end{array}
double f(double x, double y, double z, double t, double a, double b) {
        double r815596 = x;
        double r815597 = y;
        double r815598 = r815596 + r815597;
        double r815599 = z;
        double r815600 = r815598 * r815599;
        double r815601 = t;
        double r815602 = r815601 + r815597;
        double r815603 = a;
        double r815604 = r815602 * r815603;
        double r815605 = r815600 + r815604;
        double r815606 = b;
        double r815607 = r815597 * r815606;
        double r815608 = r815605 - r815607;
        double r815609 = r815596 + r815601;
        double r815610 = r815609 + r815597;
        double r815611 = r815608 / r815610;
        return r815611;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r815612 = x;
        double r815613 = y;
        double r815614 = r815612 + r815613;
        double r815615 = z;
        double r815616 = r815614 * r815615;
        double r815617 = t;
        double r815618 = r815617 + r815613;
        double r815619 = a;
        double r815620 = r815618 * r815619;
        double r815621 = r815616 + r815620;
        double r815622 = b;
        double r815623 = r815613 * r815622;
        double r815624 = r815621 - r815623;
        double r815625 = r815612 + r815617;
        double r815626 = r815625 + r815613;
        double r815627 = r815624 / r815626;
        double r815628 = -inf.0;
        bool r815629 = r815627 <= r815628;
        double r815630 = 8.806162963127991e+244;
        bool r815631 = r815627 <= r815630;
        double r815632 = !r815631;
        bool r815633 = r815629 || r815632;
        double r815634 = r815619 + r815615;
        double r815635 = r815634 - r815622;
        double r815636 = 1.0;
        double r815637 = r815636 * r815627;
        double r815638 = r815633 ? r815635 : r815637;
        return r815638;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Bits error versus a

Bits error versus b

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original26.7
Target11.1
Herbie7.4
\[\begin{array}{l} \mathbf{if}\;\frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{\left(x + t\right) + y} \lt -3.5813117084150564 \cdot 10^{153}:\\ \;\;\;\;\left(z + a\right) - b\\ \mathbf{elif}\;\frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{\left(x + t\right) + y} \lt 1.2285964308315609 \cdot 10^{82}:\\ \;\;\;\;\frac{1}{\frac{\left(x + t\right) + y}{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}}\\ \mathbf{else}:\\ \;\;\;\;\left(z + a\right) - b\\ \end{array}\]

Derivation

  1. Split input into 2 regimes
  2. if (/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) (+ (+ x t) y)) < -inf.0 or 8.806162963127991e+244 < (/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) (+ (+ x t) y))

    1. Initial program 61.6

      \[\frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{\left(x + t\right) + y}\]
    2. Using strategy rm
    3. Applied clear-num61.6

      \[\leadsto \color{blue}{\frac{1}{\frac{\left(x + t\right) + y}{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}}}\]
    4. Taylor expanded around 0 16.9

      \[\leadsto \color{blue}{\left(a + z\right) - b}\]

    if -inf.0 < (/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) (+ (+ x t) y)) < 8.806162963127991e+244

    1. Initial program 0.3

      \[\frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{\left(x + t\right) + y}\]
    2. Using strategy rm
    3. Applied clear-num0.4

      \[\leadsto \color{blue}{\frac{1}{\frac{\left(x + t\right) + y}{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}}}\]
    4. Using strategy rm
    5. Applied *-un-lft-identity0.4

      \[\leadsto \frac{1}{\frac{\left(x + t\right) + y}{\color{blue}{1 \cdot \left(\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b\right)}}}\]
    6. Applied *-un-lft-identity0.4

      \[\leadsto \frac{1}{\frac{\color{blue}{1 \cdot \left(\left(x + t\right) + y\right)}}{1 \cdot \left(\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b\right)}}\]
    7. Applied times-frac0.4

      \[\leadsto \frac{1}{\color{blue}{\frac{1}{1} \cdot \frac{\left(x + t\right) + y}{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}}}\]
    8. Applied add-cube-cbrt0.4

      \[\leadsto \frac{\color{blue}{\left(\sqrt[3]{1} \cdot \sqrt[3]{1}\right) \cdot \sqrt[3]{1}}}{\frac{1}{1} \cdot \frac{\left(x + t\right) + y}{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}}\]
    9. Applied times-frac0.4

      \[\leadsto \color{blue}{\frac{\sqrt[3]{1} \cdot \sqrt[3]{1}}{\frac{1}{1}} \cdot \frac{\sqrt[3]{1}}{\frac{\left(x + t\right) + y}{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}}}\]
    10. Simplified0.4

      \[\leadsto \color{blue}{1} \cdot \frac{\sqrt[3]{1}}{\frac{\left(x + t\right) + y}{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}}\]
    11. Simplified0.3

      \[\leadsto 1 \cdot \color{blue}{\frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{\left(x + t\right) + y}}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification7.4

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{\left(x + t\right) + y} = -\infty \lor \neg \left(\frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{\left(x + t\right) + y} \le 8.8061629631279907 \cdot 10^{244}\right):\\ \;\;\;\;\left(a + z\right) - b\\ \mathbf{else}:\\ \;\;\;\;1 \cdot \frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{\left(x + t\right) + y}\\ \end{array}\]

Reproduce

herbie shell --seed 2020039 
(FPCore (x y z t a b)
  :name "AI.Clustering.Hierarchical.Internal:ward from clustering-0.2.1"
  :precision binary64

  :herbie-target
  (if (< (/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) (+ (+ x t) y)) -3.5813117084150564e+153) (- (+ z a) b) (if (< (/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) (+ (+ x t) y)) 1.2285964308315609e+82) (/ 1 (/ (+ (+ x t) y) (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)))) (- (+ z a) b)))

  (/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) (+ (+ x t) y)))