Average Error: 26.3 → 21.5
Time: 5.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.25150232717518858 \cdot 10^{200}:\\ \;\;\;\;a - \frac{y}{\frac{\left(x + t\right) + y}{b}}\\ \mathbf{elif}\;t \le -4.1840463071979065 \cdot 10^{-131}:\\ \;\;\;\;\frac{\left(x + y\right) \cdot z + \left(t + y\right) \cdot a}{\left(x + t\right) + y} - \frac{y}{\frac{\left(x + t\right) + y}{b}}\\ \mathbf{elif}\;t \le 6.63565468032893206 \cdot 10^{-276}:\\ \;\;\;\;z - y \cdot \frac{b}{\left(x + t\right) + y}\\ \mathbf{elif}\;t \le 5.9747624034034444 \cdot 10^{-75}:\\ \;\;\;\;\frac{\left(x + y\right) \cdot z + \left(t + y\right) \cdot a}{\left(x + t\right) + y} - \frac{y}{\frac{\left(x + t\right) + y}{b}}\\ \mathbf{elif}\;t \le 2.51319291468979468 \cdot 10^{-6}:\\ \;\;\;\;z - y \cdot \frac{b}{\left(x + t\right) + y}\\ \mathbf{elif}\;t \le 3.53162670404046633 \cdot 10^{64}:\\ \;\;\;\;\frac{\left(x + y\right) \cdot z + \left(t + y\right) \cdot a}{\left(x + t\right) + y} - \frac{y}{\frac{\left(x + t\right) + y}{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.25150232717518858 \cdot 10^{200}:\\
\;\;\;\;a - \frac{y}{\frac{\left(x + t\right) + y}{b}}\\

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

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

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

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

\mathbf{elif}\;t \le 3.53162670404046633 \cdot 10^{64}:\\
\;\;\;\;\frac{\left(x + y\right) \cdot z + \left(t + y\right) \cdot a}{\left(x + t\right) + y} - \frac{y}{\frac{\left(x + t\right) + y}{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 r987376 = x;
        double r987377 = y;
        double r987378 = r987376 + r987377;
        double r987379 = z;
        double r987380 = r987378 * r987379;
        double r987381 = t;
        double r987382 = r987381 + r987377;
        double r987383 = a;
        double r987384 = r987382 * r987383;
        double r987385 = r987380 + r987384;
        double r987386 = b;
        double r987387 = r987377 * r987386;
        double r987388 = r987385 - r987387;
        double r987389 = r987376 + r987381;
        double r987390 = r987389 + r987377;
        double r987391 = r987388 / r987390;
        return r987391;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r987392 = t;
        double r987393 = -1.2515023271751886e+200;
        bool r987394 = r987392 <= r987393;
        double r987395 = a;
        double r987396 = y;
        double r987397 = x;
        double r987398 = r987397 + r987392;
        double r987399 = r987398 + r987396;
        double r987400 = b;
        double r987401 = r987399 / r987400;
        double r987402 = r987396 / r987401;
        double r987403 = r987395 - r987402;
        double r987404 = -4.1840463071979065e-131;
        bool r987405 = r987392 <= r987404;
        double r987406 = r987397 + r987396;
        double r987407 = z;
        double r987408 = r987406 * r987407;
        double r987409 = r987392 + r987396;
        double r987410 = r987409 * r987395;
        double r987411 = r987408 + r987410;
        double r987412 = r987411 / r987399;
        double r987413 = r987412 - r987402;
        double r987414 = 6.635654680328932e-276;
        bool r987415 = r987392 <= r987414;
        double r987416 = r987400 / r987399;
        double r987417 = r987396 * r987416;
        double r987418 = r987407 - r987417;
        double r987419 = 5.974762403403444e-75;
        bool r987420 = r987392 <= r987419;
        double r987421 = 2.5131929146897947e-06;
        bool r987422 = r987392 <= r987421;
        double r987423 = 3.5316267040404663e+64;
        bool r987424 = r987392 <= r987423;
        double r987425 = r987424 ? r987413 : r987403;
        double r987426 = r987422 ? r987418 : r987425;
        double r987427 = r987420 ? r987413 : r987426;
        double r987428 = r987415 ? r987418 : r987427;
        double r987429 = r987405 ? r987413 : r987428;
        double r987430 = r987394 ? r987403 : r987429;
        return r987430;
}

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.3
Target11.3
Herbie21.5
\[\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 3 regimes
  2. if t < -1.2515023271751886e+200 or 3.5316267040404663e+64 < t

    1. Initial program 34.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 div-sub34.6

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

      \[\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.2515023271751886e+200 < t < -4.1840463071979065e-131 or 6.635654680328932e-276 < t < 5.974762403403444e-75 or 2.5131929146897947e-06 < t < 3.5316267040404663e+64

    1. Initial program 23.7

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

      \[\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}}}\]

    if -4.1840463071979065e-131 < t < 6.635654680328932e-276 or 5.974762403403444e-75 < t < 2.5131929146897947e-06

    1. Initial program 21.7

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

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

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

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

      \[\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. Taylor expanded around inf 20.7

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \le -1.25150232717518858 \cdot 10^{200}:\\ \;\;\;\;a - \frac{y}{\frac{\left(x + t\right) + y}{b}}\\ \mathbf{elif}\;t \le -4.1840463071979065 \cdot 10^{-131}:\\ \;\;\;\;\frac{\left(x + y\right) \cdot z + \left(t + y\right) \cdot a}{\left(x + t\right) + y} - \frac{y}{\frac{\left(x + t\right) + y}{b}}\\ \mathbf{elif}\;t \le 6.63565468032893206 \cdot 10^{-276}:\\ \;\;\;\;z - y \cdot \frac{b}{\left(x + t\right) + y}\\ \mathbf{elif}\;t \le 5.9747624034034444 \cdot 10^{-75}:\\ \;\;\;\;\frac{\left(x + y\right) \cdot z + \left(t + y\right) \cdot a}{\left(x + t\right) + y} - \frac{y}{\frac{\left(x + t\right) + y}{b}}\\ \mathbf{elif}\;t \le 2.51319291468979468 \cdot 10^{-6}:\\ \;\;\;\;z - y \cdot \frac{b}{\left(x + t\right) + y}\\ \mathbf{elif}\;t \le 3.53162670404046633 \cdot 10^{64}:\\ \;\;\;\;\frac{\left(x + y\right) \cdot z + \left(t + y\right) \cdot a}{\left(x + t\right) + y} - \frac{y}{\frac{\left(x + t\right) + y}{b}}\\ \mathbf{else}:\\ \;\;\;\;a - \frac{y}{\frac{\left(x + t\right) + y}{b}}\\ \end{array}\]

Reproduce

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