Average Error: 27.4 → 21.2
Time: 7.6s
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 -4.807903299930362833843130917719969543925 \cdot 10^{135}:\\ \;\;\;\;a - \frac{y}{\frac{\left(x + t\right) + y}{b}}\\ \mathbf{elif}\;t \le -5.211939163860913460987765334651053508883 \cdot 10^{78}:\\ \;\;\;\;z - \frac{y}{\left(x + t\right) + y} \cdot b\\ \mathbf{elif}\;t \le -19299645594025082417577984:\\ \;\;\;\;\frac{\left(x + y\right) \cdot z + \left(t + y\right) \cdot a}{\left(x + t\right) + y} - \frac{y}{\left(x + t\right) + y} \cdot b\\ \mathbf{elif}\;t \le 8.687119915670658479665691781826899079064 \cdot 10^{-203}:\\ \;\;\;\;z - \frac{y}{\left(x + t\right) + y} \cdot b\\ \mathbf{elif}\;t \le 5.356824973557869415814992397543812282387 \cdot 10^{-118}:\\ \;\;\;\;\frac{\left(x + y\right) \cdot z + \left(t + y\right) \cdot a}{\left(x + t\right) + y} - \frac{y}{\left(x + t\right) + y} \cdot b\\ \mathbf{elif}\;t \le 6.431391600986251804582146743462556059272 \cdot 10^{-87}:\\ \;\;\;\;z - \frac{y}{\left(x + t\right) + y} \cdot b\\ \mathbf{elif}\;t \le 1.80321368192432516175303989799957300718 \cdot 10^{46}:\\ \;\;\;\;\frac{\left(x + y\right) \cdot z + \left(t + y\right) \cdot a}{\left(x + t\right) + y} - \frac{y}{\left(x + t\right) + y} \cdot b\\ \mathbf{elif}\;t \le 4.374875846080029950304637730493634962138 \cdot 10^{75}:\\ \;\;\;\;z - \frac{y}{\left(x + t\right) + y} \cdot b\\ \mathbf{elif}\;t \le 6.07370089896284287912300074628530575732 \cdot 10^{156}:\\ \;\;\;\;\frac{\left(x + y\right) \cdot z + \left(t + y\right) \cdot a}{\left(x + t\right) + y} - \frac{y}{\left(x + t\right) + y} \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 -4.807903299930362833843130917719969543925 \cdot 10^{135}:\\
\;\;\;\;a - \frac{y}{\frac{\left(x + t\right) + y}{b}}\\

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

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

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

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

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

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

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

\mathbf{elif}\;t \le 6.07370089896284287912300074628530575732 \cdot 10^{156}:\\
\;\;\;\;\frac{\left(x + y\right) \cdot z + \left(t + y\right) \cdot a}{\left(x + t\right) + y} - \frac{y}{\left(x + t\right) + y} \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 r1446787 = x;
        double r1446788 = y;
        double r1446789 = r1446787 + r1446788;
        double r1446790 = z;
        double r1446791 = r1446789 * r1446790;
        double r1446792 = t;
        double r1446793 = r1446792 + r1446788;
        double r1446794 = a;
        double r1446795 = r1446793 * r1446794;
        double r1446796 = r1446791 + r1446795;
        double r1446797 = b;
        double r1446798 = r1446788 * r1446797;
        double r1446799 = r1446796 - r1446798;
        double r1446800 = r1446787 + r1446792;
        double r1446801 = r1446800 + r1446788;
        double r1446802 = r1446799 / r1446801;
        return r1446802;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r1446803 = t;
        double r1446804 = -4.807903299930363e+135;
        bool r1446805 = r1446803 <= r1446804;
        double r1446806 = a;
        double r1446807 = y;
        double r1446808 = x;
        double r1446809 = r1446808 + r1446803;
        double r1446810 = r1446809 + r1446807;
        double r1446811 = b;
        double r1446812 = r1446810 / r1446811;
        double r1446813 = r1446807 / r1446812;
        double r1446814 = r1446806 - r1446813;
        double r1446815 = -5.2119391638609135e+78;
        bool r1446816 = r1446803 <= r1446815;
        double r1446817 = z;
        double r1446818 = r1446807 / r1446810;
        double r1446819 = r1446818 * r1446811;
        double r1446820 = r1446817 - r1446819;
        double r1446821 = -1.9299645594025082e+25;
        bool r1446822 = r1446803 <= r1446821;
        double r1446823 = r1446808 + r1446807;
        double r1446824 = r1446823 * r1446817;
        double r1446825 = r1446803 + r1446807;
        double r1446826 = r1446825 * r1446806;
        double r1446827 = r1446824 + r1446826;
        double r1446828 = r1446827 / r1446810;
        double r1446829 = r1446828 - r1446819;
        double r1446830 = 8.687119915670658e-203;
        bool r1446831 = r1446803 <= r1446830;
        double r1446832 = 5.356824973557869e-118;
        bool r1446833 = r1446803 <= r1446832;
        double r1446834 = 6.431391600986252e-87;
        bool r1446835 = r1446803 <= r1446834;
        double r1446836 = 1.8032136819243252e+46;
        bool r1446837 = r1446803 <= r1446836;
        double r1446838 = 4.37487584608003e+75;
        bool r1446839 = r1446803 <= r1446838;
        double r1446840 = 6.073700898962843e+156;
        bool r1446841 = r1446803 <= r1446840;
        double r1446842 = r1446841 ? r1446829 : r1446814;
        double r1446843 = r1446839 ? r1446820 : r1446842;
        double r1446844 = r1446837 ? r1446829 : r1446843;
        double r1446845 = r1446835 ? r1446820 : r1446844;
        double r1446846 = r1446833 ? r1446829 : r1446845;
        double r1446847 = r1446831 ? r1446820 : r1446846;
        double r1446848 = r1446822 ? r1446829 : r1446847;
        double r1446849 = r1446816 ? r1446820 : r1446848;
        double r1446850 = r1446805 ? r1446814 : r1446849;
        return r1446850;
}

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.4
Target11.0
Herbie21.2
\[\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.581311708415056427521064305370896655752 \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.228596430831560895857110658734089400289 \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 3 regimes
  2. if t < -4.807903299930363e+135 or 6.073700898962843e+156 < t

    1. Initial program 36.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. Using strategy rm
    3. Applied div-sub36.0

      \[\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*33.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. Taylor expanded around 0 20.9

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

    if -4.807903299930363e+135 < t < -5.2119391638609135e+78 or -1.9299645594025082e+25 < t < 8.687119915670658e-203 or 5.356824973557869e-118 < t < 6.431391600986252e-87 or 1.8032136819243252e+46 < t < 4.37487584608003e+75

    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*22.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/20.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. Taylor expanded around inf 21.8

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

    if -5.2119391638609135e+78 < t < -1.9299645594025082e+25 or 8.687119915670658e-203 < t < 5.356824973557869e-118 or 6.431391600986252e-87 < t < 1.8032136819243252e+46 or 4.37487584608003e+75 < t < 6.073700898962843e+156

    1. Initial program 24.2

      \[\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.2

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

      \[\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}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification21.2

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \le -4.807903299930362833843130917719969543925 \cdot 10^{135}:\\ \;\;\;\;a - \frac{y}{\frac{\left(x + t\right) + y}{b}}\\ \mathbf{elif}\;t \le -5.211939163860913460987765334651053508883 \cdot 10^{78}:\\ \;\;\;\;z - \frac{y}{\left(x + t\right) + y} \cdot b\\ \mathbf{elif}\;t \le -19299645594025082417577984:\\ \;\;\;\;\frac{\left(x + y\right) \cdot z + \left(t + y\right) \cdot a}{\left(x + t\right) + y} - \frac{y}{\left(x + t\right) + y} \cdot b\\ \mathbf{elif}\;t \le 8.687119915670658479665691781826899079064 \cdot 10^{-203}:\\ \;\;\;\;z - \frac{y}{\left(x + t\right) + y} \cdot b\\ \mathbf{elif}\;t \le 5.356824973557869415814992397543812282387 \cdot 10^{-118}:\\ \;\;\;\;\frac{\left(x + y\right) \cdot z + \left(t + y\right) \cdot a}{\left(x + t\right) + y} - \frac{y}{\left(x + t\right) + y} \cdot b\\ \mathbf{elif}\;t \le 6.431391600986251804582146743462556059272 \cdot 10^{-87}:\\ \;\;\;\;z - \frac{y}{\left(x + t\right) + y} \cdot b\\ \mathbf{elif}\;t \le 1.80321368192432516175303989799957300718 \cdot 10^{46}:\\ \;\;\;\;\frac{\left(x + y\right) \cdot z + \left(t + y\right) \cdot a}{\left(x + t\right) + y} - \frac{y}{\left(x + t\right) + y} \cdot b\\ \mathbf{elif}\;t \le 4.374875846080029950304637730493634962138 \cdot 10^{75}:\\ \;\;\;\;z - \frac{y}{\left(x + t\right) + y} \cdot b\\ \mathbf{elif}\;t \le 6.07370089896284287912300074628530575732 \cdot 10^{156}:\\ \;\;\;\;\frac{\left(x + y\right) \cdot z + \left(t + y\right) \cdot a}{\left(x + t\right) + y} - \frac{y}{\left(x + t\right) + y} \cdot b\\ \mathbf{else}:\\ \;\;\;\;a - \frac{y}{\frac{\left(x + t\right) + y}{b}}\\ \end{array}\]

Reproduce

herbie shell --seed 2019318 
(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.5813117084150564e153) (- (+ z a) b) (if (< (/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) (+ (+ x t) y)) 1.2285964308315609e82) (/ 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)))