Average Error: 27.0 → 20.9
Time: 8.2s
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}\;a \le -1.54343324341211138 \cdot 10^{134}:\\ \;\;\;\;a - \frac{y}{\left(x + t\right) + y} \cdot b\\ \mathbf{elif}\;a \le -2.2002211606234215 \cdot 10^{-41}:\\ \;\;\;\;\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) \cdot \frac{1}{\left(x + t\right) + y} - \frac{y}{\left(x + t\right) + y} \cdot b\\ \mathbf{elif}\;a \le 5.11049872831381705 \cdot 10^{-217}:\\ \;\;\;\;z - \frac{y}{\left(x + t\right) + y} \cdot b\\ \mathbf{elif}\;a \le 1.43065941407828646 \cdot 10^{-141}:\\ \;\;\;\;\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) \cdot \frac{1}{\left(x + t\right) + y} - \frac{y}{\left(x + t\right) + y} \cdot b\\ \mathbf{elif}\;a \le 2.49584360300908932 \cdot 10^{-100}:\\ \;\;\;\;z - \frac{y}{\left(x + t\right) + y} \cdot b\\ \mathbf{elif}\;a \le 7.0170355788870731 \cdot 10^{30}:\\ \;\;\;\;\frac{\left(\sqrt[3]{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b} \cdot \sqrt[3]{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}\right) \cdot \sqrt[3]{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}}{\left(x + t\right) + y}\\ \mathbf{else}:\\ \;\;\;\;a - \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}\;a \le -1.54343324341211138 \cdot 10^{134}:\\
\;\;\;\;a - \frac{y}{\left(x + t\right) + y} \cdot b\\

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

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

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

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

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

\mathbf{else}:\\
\;\;\;\;a - \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 r1037419 = x;
        double r1037420 = y;
        double r1037421 = r1037419 + r1037420;
        double r1037422 = z;
        double r1037423 = r1037421 * r1037422;
        double r1037424 = t;
        double r1037425 = r1037424 + r1037420;
        double r1037426 = a;
        double r1037427 = r1037425 * r1037426;
        double r1037428 = r1037423 + r1037427;
        double r1037429 = b;
        double r1037430 = r1037420 * r1037429;
        double r1037431 = r1037428 - r1037430;
        double r1037432 = r1037419 + r1037424;
        double r1037433 = r1037432 + r1037420;
        double r1037434 = r1037431 / r1037433;
        return r1037434;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r1037435 = a;
        double r1037436 = -1.5434332434121114e+134;
        bool r1037437 = r1037435 <= r1037436;
        double r1037438 = y;
        double r1037439 = x;
        double r1037440 = t;
        double r1037441 = r1037439 + r1037440;
        double r1037442 = r1037441 + r1037438;
        double r1037443 = r1037438 / r1037442;
        double r1037444 = b;
        double r1037445 = r1037443 * r1037444;
        double r1037446 = r1037435 - r1037445;
        double r1037447 = -2.2002211606234215e-41;
        bool r1037448 = r1037435 <= r1037447;
        double r1037449 = r1037439 + r1037438;
        double r1037450 = z;
        double r1037451 = r1037449 * r1037450;
        double r1037452 = r1037440 + r1037438;
        double r1037453 = r1037452 * r1037435;
        double r1037454 = r1037451 + r1037453;
        double r1037455 = 1.0;
        double r1037456 = r1037455 / r1037442;
        double r1037457 = r1037454 * r1037456;
        double r1037458 = r1037457 - r1037445;
        double r1037459 = 5.110498728313817e-217;
        bool r1037460 = r1037435 <= r1037459;
        double r1037461 = r1037450 - r1037445;
        double r1037462 = 1.4306594140782865e-141;
        bool r1037463 = r1037435 <= r1037462;
        double r1037464 = 2.4958436030090893e-100;
        bool r1037465 = r1037435 <= r1037464;
        double r1037466 = 7.017035578887073e+30;
        bool r1037467 = r1037435 <= r1037466;
        double r1037468 = r1037438 * r1037444;
        double r1037469 = r1037454 - r1037468;
        double r1037470 = cbrt(r1037469);
        double r1037471 = r1037470 * r1037470;
        double r1037472 = r1037471 * r1037470;
        double r1037473 = r1037472 / r1037442;
        double r1037474 = r1037467 ? r1037473 : r1037446;
        double r1037475 = r1037465 ? r1037461 : r1037474;
        double r1037476 = r1037463 ? r1037458 : r1037475;
        double r1037477 = r1037460 ? r1037461 : r1037476;
        double r1037478 = r1037448 ? r1037458 : r1037477;
        double r1037479 = r1037437 ? r1037446 : r1037478;
        return r1037479;
}

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.4
Herbie20.9
\[\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 4 regimes
  2. if a < -1.5434332434121114e+134 or 7.017035578887073e+30 < a

    1. Initial program 39.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-sub39.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*39.1

      \[\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/38.3

      \[\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 0 24.6

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

    if -1.5434332434121114e+134 < a < -2.2002211606234215e-41 or 5.110498728313817e-217 < a < 1.4306594140782865e-141

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

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

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

    if -2.2002211606234215e-41 < a < 5.110498728313817e-217 or 1.4306594140782865e-141 < a < 2.4958436030090893e-100

    1. Initial program 19.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-sub19.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*15.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/14.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 18.7

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

    if 2.4958436030090893e-100 < a < 7.017035578887073e+30

    1. Initial program 19.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 add-cube-cbrt20.6

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \le -1.54343324341211138 \cdot 10^{134}:\\ \;\;\;\;a - \frac{y}{\left(x + t\right) + y} \cdot b\\ \mathbf{elif}\;a \le -2.2002211606234215 \cdot 10^{-41}:\\ \;\;\;\;\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) \cdot \frac{1}{\left(x + t\right) + y} - \frac{y}{\left(x + t\right) + y} \cdot b\\ \mathbf{elif}\;a \le 5.11049872831381705 \cdot 10^{-217}:\\ \;\;\;\;z - \frac{y}{\left(x + t\right) + y} \cdot b\\ \mathbf{elif}\;a \le 1.43065941407828646 \cdot 10^{-141}:\\ \;\;\;\;\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) \cdot \frac{1}{\left(x + t\right) + y} - \frac{y}{\left(x + t\right) + y} \cdot b\\ \mathbf{elif}\;a \le 2.49584360300908932 \cdot 10^{-100}:\\ \;\;\;\;z - \frac{y}{\left(x + t\right) + y} \cdot b\\ \mathbf{elif}\;a \le 7.0170355788870731 \cdot 10^{30}:\\ \;\;\;\;\frac{\left(\sqrt[3]{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b} \cdot \sqrt[3]{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}\right) \cdot \sqrt[3]{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}}{\left(x + t\right) + y}\\ \mathbf{else}:\\ \;\;\;\;a - \frac{y}{\left(x + t\right) + y} \cdot b\\ \end{array}\]

Reproduce

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