Average Error: 26.6 → 22.2
Time: 16.8s
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.236901398753610078656661269003413289739 \cdot 10^{86}:\\ \;\;\;\;a - \frac{y}{\frac{\left(x + t\right) + y}{b}}\\ \mathbf{elif}\;t \le -0.001529354401011888105535452275773877772735:\\ \;\;\;\;\frac{1}{\frac{\left(x + t\right) + y}{\left(x + y\right) \cdot z + \left(t + y\right) \cdot a}} - y \cdot \frac{b}{\left(x + t\right) + y}\\ \mathbf{elif}\;t \le -1.804020817888939519473717588844704322354 \cdot 10^{-25}:\\ \;\;\;\;z - \frac{y}{\frac{\left(x + t\right) + y}{b}}\\ \mathbf{elif}\;t \le -5.676644919435613717358971575377219371974 \cdot 10^{-153}:\\ \;\;\;\;\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 2.103738214016849390361111493823193821865 \cdot 10^{-36}:\\ \;\;\;\;z - \frac{y}{\frac{\left(x + t\right) + y}{b}}\\ \mathbf{elif}\;t \le 4.75244878113231928218391541479238378067 \cdot 10^{69} \lor \neg \left(t \le 1.2953135415294240794125654200317299864 \cdot 10^{154}\right):\\ \;\;\;\;a - \frac{y}{\frac{\left(x + t\right) + y}{b}}\\ \mathbf{else}:\\ \;\;\;\;\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\\ \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.236901398753610078656661269003413289739 \cdot 10^{86}:\\
\;\;\;\;a - \frac{y}{\frac{\left(x + t\right) + y}{b}}\\

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

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

\mathbf{elif}\;t \le -5.676644919435613717358971575377219371974 \cdot 10^{-153}:\\
\;\;\;\;\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 2.103738214016849390361111493823193821865 \cdot 10^{-36}:\\
\;\;\;\;z - \frac{y}{\frac{\left(x + t\right) + y}{b}}\\

\mathbf{elif}\;t \le 4.75244878113231928218391541479238378067 \cdot 10^{69} \lor \neg \left(t \le 1.2953135415294240794125654200317299864 \cdot 10^{154}\right):\\
\;\;\;\;a - \frac{y}{\frac{\left(x + t\right) + y}{b}}\\

\mathbf{else}:\\
\;\;\;\;\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\\

\end{array}
double f(double x, double y, double z, double t, double a, double b) {
        double r947259 = x;
        double r947260 = y;
        double r947261 = r947259 + r947260;
        double r947262 = z;
        double r947263 = r947261 * r947262;
        double r947264 = t;
        double r947265 = r947264 + r947260;
        double r947266 = a;
        double r947267 = r947265 * r947266;
        double r947268 = r947263 + r947267;
        double r947269 = b;
        double r947270 = r947260 * r947269;
        double r947271 = r947268 - r947270;
        double r947272 = r947259 + r947264;
        double r947273 = r947272 + r947260;
        double r947274 = r947271 / r947273;
        return r947274;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r947275 = t;
        double r947276 = -1.2369013987536101e+86;
        bool r947277 = r947275 <= r947276;
        double r947278 = a;
        double r947279 = y;
        double r947280 = x;
        double r947281 = r947280 + r947275;
        double r947282 = r947281 + r947279;
        double r947283 = b;
        double r947284 = r947282 / r947283;
        double r947285 = r947279 / r947284;
        double r947286 = r947278 - r947285;
        double r947287 = -0.001529354401011888;
        bool r947288 = r947275 <= r947287;
        double r947289 = 1.0;
        double r947290 = r947280 + r947279;
        double r947291 = z;
        double r947292 = r947290 * r947291;
        double r947293 = r947275 + r947279;
        double r947294 = r947293 * r947278;
        double r947295 = r947292 + r947294;
        double r947296 = r947282 / r947295;
        double r947297 = r947289 / r947296;
        double r947298 = r947283 / r947282;
        double r947299 = r947279 * r947298;
        double r947300 = r947297 - r947299;
        double r947301 = -1.8040208178889395e-25;
        bool r947302 = r947275 <= r947301;
        double r947303 = r947291 - r947285;
        double r947304 = -5.676644919435614e-153;
        bool r947305 = r947275 <= r947304;
        double r947306 = r947295 / r947282;
        double r947307 = r947279 / r947282;
        double r947308 = r947307 * r947283;
        double r947309 = r947306 - r947308;
        double r947310 = 2.1037382140168494e-36;
        bool r947311 = r947275 <= r947310;
        double r947312 = 4.752448781132319e+69;
        bool r947313 = r947275 <= r947312;
        double r947314 = 1.2953135415294241e+154;
        bool r947315 = r947275 <= r947314;
        double r947316 = !r947315;
        bool r947317 = r947313 || r947316;
        double r947318 = r947317 ? r947286 : r947309;
        double r947319 = r947311 ? r947303 : r947318;
        double r947320 = r947305 ? r947309 : r947319;
        double r947321 = r947302 ? r947303 : r947320;
        double r947322 = r947288 ? r947300 : r947321;
        double r947323 = r947277 ? r947286 : r947322;
        return r947323;
}

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.6
Target11.6
Herbie22.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 4 regimes
  2. if t < -1.2369013987536101e+86 or 2.1037382140168494e-36 < t < 4.752448781132319e+69 or 1.2953135415294241e+154 < t

    1. Initial program 32.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-sub32.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*29.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 0 24.4

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

    if -1.2369013987536101e+86 < t < -0.001529354401011888

    1. Initial program 24.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-sub24.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 *-un-lft-identity24.0

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

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

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

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

    if -0.001529354401011888 < t < -1.8040208178889395e-25 or -5.676644919435614e-153 < t < 2.1037382140168494e-36

    1. Initial program 22.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-sub22.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*20.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 20.6

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

    if -1.8040208178889395e-25 < t < -5.676644919435614e-153 or 4.752448781132319e+69 < t < 1.2953135415294241e+154

    1. Initial program 24.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-sub24.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*21.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/21.0

      \[\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 4 regimes into one program.
  4. Final simplification22.2

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \le -1.236901398753610078656661269003413289739 \cdot 10^{86}:\\ \;\;\;\;a - \frac{y}{\frac{\left(x + t\right) + y}{b}}\\ \mathbf{elif}\;t \le -0.001529354401011888105535452275773877772735:\\ \;\;\;\;\frac{1}{\frac{\left(x + t\right) + y}{\left(x + y\right) \cdot z + \left(t + y\right) \cdot a}} - y \cdot \frac{b}{\left(x + t\right) + y}\\ \mathbf{elif}\;t \le -1.804020817888939519473717588844704322354 \cdot 10^{-25}:\\ \;\;\;\;z - \frac{y}{\frac{\left(x + t\right) + y}{b}}\\ \mathbf{elif}\;t \le -5.676644919435613717358971575377219371974 \cdot 10^{-153}:\\ \;\;\;\;\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 2.103738214016849390361111493823193821865 \cdot 10^{-36}:\\ \;\;\;\;z - \frac{y}{\frac{\left(x + t\right) + y}{b}}\\ \mathbf{elif}\;t \le 4.75244878113231928218391541479238378067 \cdot 10^{69} \lor \neg \left(t \le 1.2953135415294240794125654200317299864 \cdot 10^{154}\right):\\ \;\;\;\;a - \frac{y}{\frac{\left(x + t\right) + y}{b}}\\ \mathbf{else}:\\ \;\;\;\;\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\\ \end{array}\]

Reproduce

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