Average Error: 27.0 → 22.0
Time: 6.4s
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}\;t \le -1.6986254320624221 \cdot 10^{168}:\\ \;\;\;\;a - \frac{y}{\frac{\left(x + t\right) + y}{b}}\\ \mathbf{elif}\;t \le -4.77185841419090264 \cdot 10^{97}:\\ \;\;\;\;z - \frac{y}{\frac{\left(x + t\right) + y}{b}}\\ \mathbf{elif}\;t \le -6.2691502506957849 \cdot 10^{93}:\\ \;\;\;\;a\\ \mathbf{elif}\;t \le -2.3344990110164508 \cdot 10^{-75}:\\ \;\;\;\;\frac{1}{\frac{\left(x + t\right) + y}{\left(x + y\right) \cdot z + \left(t + y\right) \cdot a}} - \frac{y}{\left(x + t\right) + y} \cdot b\\ \mathbf{elif}\;t \le -1.87134248020096529 \cdot 10^{-164}:\\ \;\;\;\;z - \frac{y}{\frac{\left(x + t\right) + y}{b}}\\ \mathbf{elif}\;t \le -3.67353273866948948 \cdot 10^{-268}:\\ \;\;\;\;\frac{\left(x + y\right) \cdot z + \left(t + y\right) \cdot a}{\left(x + t\right) + y} - \sqrt[3]{{\left(\frac{y}{\left(x + t\right) + y}\right)}^{3}} \cdot b\\ \mathbf{elif}\;t \le 4.38041407240006756 \cdot 10^{-97}:\\ \;\;\;\;z - \frac{y}{\frac{\left(x + t\right) + y}{b}}\\ \mathbf{elif}\;t \le 2.197975804352339 \cdot 10^{135}:\\ \;\;\;\;\frac{\left(x + y\right) \cdot z + \left(t + y\right) \cdot a}{\left(x + t\right) + y} - \left(y \cdot \frac{1}{\left(x + t\right) + y}\right) \cdot b\\ \mathbf{else}:\\ \;\;\;\;a - \frac{y}{\frac{\left(x + t\right) + y}{b}}\\ \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}\;t \le -1.6986254320624221 \cdot 10^{168}:\\
\;\;\;\;a - \frac{y}{\frac{\left(x + t\right) + y}{b}}\\

\mathbf{elif}\;t \le -4.77185841419090264 \cdot 10^{97}:\\
\;\;\;\;z - \frac{y}{\frac{\left(x + t\right) + y}{b}}\\

\mathbf{elif}\;t \le -6.2691502506957849 \cdot 10^{93}:\\
\;\;\;\;a\\

\mathbf{elif}\;t \le -2.3344990110164508 \cdot 10^{-75}:\\
\;\;\;\;\frac{1}{\frac{\left(x + t\right) + y}{\left(x + y\right) \cdot z + \left(t + y\right) \cdot a}} - \frac{y}{\left(x + t\right) + y} \cdot b\\

\mathbf{elif}\;t \le -1.87134248020096529 \cdot 10^{-164}:\\
\;\;\;\;z - \frac{y}{\frac{\left(x + t\right) + y}{b}}\\

\mathbf{elif}\;t \le -3.67353273866948948 \cdot 10^{-268}:\\
\;\;\;\;\frac{\left(x + y\right) \cdot z + \left(t + y\right) \cdot a}{\left(x + t\right) + y} - \sqrt[3]{{\left(\frac{y}{\left(x + t\right) + y}\right)}^{3}} \cdot b\\

\mathbf{elif}\;t \le 4.38041407240006756 \cdot 10^{-97}:\\
\;\;\;\;z - \frac{y}{\frac{\left(x + t\right) + y}{b}}\\

\mathbf{elif}\;t \le 2.197975804352339 \cdot 10^{135}:\\
\;\;\;\;\frac{\left(x + y\right) \cdot z + \left(t + y\right) \cdot a}{\left(x + t\right) + y} - \left(y \cdot \frac{1}{\left(x + t\right) + y}\right) \cdot b\\

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

\end{array}
double f(double x, double y, double z, double t, double a, double b) {
        double r791611 = x;
        double r791612 = y;
        double r791613 = r791611 + r791612;
        double r791614 = z;
        double r791615 = r791613 * r791614;
        double r791616 = t;
        double r791617 = r791616 + r791612;
        double r791618 = a;
        double r791619 = r791617 * r791618;
        double r791620 = r791615 + r791619;
        double r791621 = b;
        double r791622 = r791612 * r791621;
        double r791623 = r791620 - r791622;
        double r791624 = r791611 + r791616;
        double r791625 = r791624 + r791612;
        double r791626 = r791623 / r791625;
        return r791626;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r791627 = t;
        double r791628 = -1.6986254320624221e+168;
        bool r791629 = r791627 <= r791628;
        double r791630 = a;
        double r791631 = y;
        double r791632 = x;
        double r791633 = r791632 + r791627;
        double r791634 = r791633 + r791631;
        double r791635 = b;
        double r791636 = r791634 / r791635;
        double r791637 = r791631 / r791636;
        double r791638 = r791630 - r791637;
        double r791639 = -4.771858414190903e+97;
        bool r791640 = r791627 <= r791639;
        double r791641 = z;
        double r791642 = r791641 - r791637;
        double r791643 = -6.269150250695785e+93;
        bool r791644 = r791627 <= r791643;
        double r791645 = -2.334499011016451e-75;
        bool r791646 = r791627 <= r791645;
        double r791647 = 1.0;
        double r791648 = r791632 + r791631;
        double r791649 = r791648 * r791641;
        double r791650 = r791627 + r791631;
        double r791651 = r791650 * r791630;
        double r791652 = r791649 + r791651;
        double r791653 = r791634 / r791652;
        double r791654 = r791647 / r791653;
        double r791655 = r791631 / r791634;
        double r791656 = r791655 * r791635;
        double r791657 = r791654 - r791656;
        double r791658 = -1.8713424802009653e-164;
        bool r791659 = r791627 <= r791658;
        double r791660 = -3.6735327386694895e-268;
        bool r791661 = r791627 <= r791660;
        double r791662 = r791652 / r791634;
        double r791663 = 3.0;
        double r791664 = pow(r791655, r791663);
        double r791665 = cbrt(r791664);
        double r791666 = r791665 * r791635;
        double r791667 = r791662 - r791666;
        double r791668 = 4.3804140724000676e-97;
        bool r791669 = r791627 <= r791668;
        double r791670 = 2.197975804352339e+135;
        bool r791671 = r791627 <= r791670;
        double r791672 = r791647 / r791634;
        double r791673 = r791631 * r791672;
        double r791674 = r791673 * r791635;
        double r791675 = r791662 - r791674;
        double r791676 = r791671 ? r791675 : r791638;
        double r791677 = r791669 ? r791642 : r791676;
        double r791678 = r791661 ? r791667 : r791677;
        double r791679 = r791659 ? r791642 : r791678;
        double r791680 = r791646 ? r791657 : r791679;
        double r791681 = r791644 ? r791630 : r791680;
        double r791682 = r791640 ? r791642 : r791681;
        double r791683 = r791629 ? r791638 : r791682;
        return r791683;
}

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

Original27.0
Target11.5
Herbie22.0
\[\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 6 regimes
  2. if t < -1.6986254320624221e+168 or 2.197975804352339e+135 < t

    1. Initial program 35.1

      \[\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 div-sub35.1

      \[\leadsto \color{blue}{\frac{\left(x + y\right) \cdot z + \left(t + y\right) \cdot a}{\left(x + t\right) + y} - \frac{y \cdot b}{\left(x + t\right) + y}}\]
    4. Using strategy rm
    5. Applied associate-/l*32.9

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

      \[\leadsto \color{blue}{a} - \frac{y}{\frac{\left(x + t\right) + y}{b}}\]

    if -1.6986254320624221e+168 < t < -4.771858414190903e+97 or -2.334499011016451e-75 < t < -1.8713424802009653e-164 or -3.6735327386694895e-268 < t < 4.3804140724000676e-97

    1. Initial program 24.8

      \[\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 div-sub24.8

      \[\leadsto \color{blue}{\frac{\left(x + y\right) \cdot z + \left(t + y\right) \cdot a}{\left(x + t\right) + y} - \frac{y \cdot b}{\left(x + t\right) + y}}\]
    4. Using strategy rm
    5. Applied associate-/l*23.7

      \[\leadsto \frac{\left(x + y\right) \cdot z + \left(t + y\right) \cdot a}{\left(x + t\right) + y} - \color{blue}{\frac{y}{\frac{\left(x + t\right) + y}{b}}}\]
    6. Taylor expanded around inf 24.1

      \[\leadsto \color{blue}{z} - \frac{y}{\frac{\left(x + t\right) + y}{b}}\]

    if -4.771858414190903e+97 < t < -6.269150250695785e+93

    1. Initial program 32.0

      \[\frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{\left(x + t\right) + y}\]
    2. Taylor expanded around 0 27.7

      \[\leadsto \color{blue}{a}\]

    if -6.269150250695785e+93 < t < -2.334499011016451e-75

    1. Initial program 23.8

      \[\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 div-sub23.8

      \[\leadsto \color{blue}{\frac{\left(x + y\right) \cdot z + \left(t + y\right) \cdot a}{\left(x + t\right) + y} - \frac{y \cdot b}{\left(x + t\right) + y}}\]
    4. Using strategy rm
    5. Applied associate-/l*19.9

      \[\leadsto \frac{\left(x + y\right) \cdot z + \left(t + y\right) \cdot a}{\left(x + t\right) + y} - \color{blue}{\frac{y}{\frac{\left(x + t\right) + y}{b}}}\]
    6. Using strategy rm
    7. Applied associate-/r/19.8

      \[\leadsto \frac{\left(x + y\right) \cdot z + \left(t + y\right) \cdot a}{\left(x + t\right) + y} - \color{blue}{\frac{y}{\left(x + t\right) + y} \cdot b}\]
    8. Using strategy rm
    9. Applied clear-num19.9

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

    if -1.8713424802009653e-164 < t < -3.6735327386694895e-268

    1. Initial program 24.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 div-sub24.3

      \[\leadsto \color{blue}{\frac{\left(x + y\right) \cdot z + \left(t + y\right) \cdot a}{\left(x + t\right) + y} - \frac{y \cdot b}{\left(x + t\right) + y}}\]
    4. Using strategy rm
    5. Applied associate-/l*21.5

      \[\leadsto \frac{\left(x + y\right) \cdot z + \left(t + y\right) \cdot a}{\left(x + t\right) + y} - \color{blue}{\frac{y}{\frac{\left(x + t\right) + y}{b}}}\]
    6. Using strategy rm
    7. Applied associate-/r/19.9

      \[\leadsto \frac{\left(x + y\right) \cdot z + \left(t + y\right) \cdot a}{\left(x + t\right) + y} - \color{blue}{\frac{y}{\left(x + t\right) + y} \cdot b}\]
    8. Using strategy rm
    9. Applied add-cbrt-cube32.5

      \[\leadsto \frac{\left(x + y\right) \cdot z + \left(t + y\right) \cdot a}{\left(x + t\right) + y} - \frac{y}{\color{blue}{\sqrt[3]{\left(\left(\left(x + t\right) + y\right) \cdot \left(\left(x + t\right) + y\right)\right) \cdot \left(\left(x + t\right) + y\right)}}} \cdot b\]
    10. Applied add-cbrt-cube38.2

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

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

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

    if 4.3804140724000676e-97 < t < 2.197975804352339e+135

    1. Initial program 23.4

      \[\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 div-sub23.4

      \[\leadsto \color{blue}{\frac{\left(x + y\right) \cdot z + \left(t + y\right) \cdot a}{\left(x + t\right) + y} - \frac{y \cdot b}{\left(x + t\right) + y}}\]
    4. Using strategy rm
    5. Applied associate-/l*20.2

      \[\leadsto \frac{\left(x + y\right) \cdot z + \left(t + y\right) \cdot a}{\left(x + t\right) + y} - \color{blue}{\frac{y}{\frac{\left(x + t\right) + y}{b}}}\]
    6. Using strategy rm
    7. Applied associate-/r/20.1

      \[\leadsto \frac{\left(x + y\right) \cdot z + \left(t + y\right) \cdot a}{\left(x + t\right) + y} - \color{blue}{\frac{y}{\left(x + t\right) + y} \cdot b}\]
    8. Using strategy rm
    9. Applied div-inv20.2

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \le -1.6986254320624221 \cdot 10^{168}:\\ \;\;\;\;a - \frac{y}{\frac{\left(x + t\right) + y}{b}}\\ \mathbf{elif}\;t \le -4.77185841419090264 \cdot 10^{97}:\\ \;\;\;\;z - \frac{y}{\frac{\left(x + t\right) + y}{b}}\\ \mathbf{elif}\;t \le -6.2691502506957849 \cdot 10^{93}:\\ \;\;\;\;a\\ \mathbf{elif}\;t \le -2.3344990110164508 \cdot 10^{-75}:\\ \;\;\;\;\frac{1}{\frac{\left(x + t\right) + y}{\left(x + y\right) \cdot z + \left(t + y\right) \cdot a}} - \frac{y}{\left(x + t\right) + y} \cdot b\\ \mathbf{elif}\;t \le -1.87134248020096529 \cdot 10^{-164}:\\ \;\;\;\;z - \frac{y}{\frac{\left(x + t\right) + y}{b}}\\ \mathbf{elif}\;t \le -3.67353273866948948 \cdot 10^{-268}:\\ \;\;\;\;\frac{\left(x + y\right) \cdot z + \left(t + y\right) \cdot a}{\left(x + t\right) + y} - \sqrt[3]{{\left(\frac{y}{\left(x + t\right) + y}\right)}^{3}} \cdot b\\ \mathbf{elif}\;t \le 4.38041407240006756 \cdot 10^{-97}:\\ \;\;\;\;z - \frac{y}{\frac{\left(x + t\right) + y}{b}}\\ \mathbf{elif}\;t \le 2.197975804352339 \cdot 10^{135}:\\ \;\;\;\;\frac{\left(x + y\right) \cdot z + \left(t + y\right) \cdot a}{\left(x + t\right) + y} - \left(y \cdot \frac{1}{\left(x + t\right) + y}\right) \cdot b\\ \mathbf{else}:\\ \;\;\;\;a - \frac{y}{\frac{\left(x + t\right) + y}{b}}\\ \end{array}\]

Reproduce

herbie shell --seed 2020025 
(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)))