Average Error: 26.8 → 19.7
Time: 10.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}\;y \le -1.080685072695562236595787579237443788954 \cdot 10^{214}:\\ \;\;\;\;z - \frac{y}{\left(x + t\right) + y} \cdot b\\ \mathbf{elif}\;y \le -1.9770205152967976990982926348554284473 \cdot 10^{65}:\\ \;\;\;\;a - \frac{y}{\left(x + t\right) + y} \cdot b\\ \mathbf{elif}\;y \le 4.258714344896704138558189467068963913256 \cdot 10^{80}:\\ \;\;\;\;\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{elif}\;y \le 2.176770691227919101745141942515187743385 \cdot 10^{233}:\\ \;\;\;\;a - \frac{y}{\left(x + t\right) + y} \cdot b\\ \mathbf{elif}\;y \le 3.982002360183062272030533575745070819145 \cdot 10^{263}:\\ \;\;\;\;z - \frac{y}{\left(x + t\right) + y} \cdot b\\ \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}\;y \le -1.080685072695562236595787579237443788954 \cdot 10^{214}:\\
\;\;\;\;z - \frac{y}{\left(x + t\right) + y} \cdot b\\

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

\mathbf{elif}\;y \le 4.258714344896704138558189467068963913256 \cdot 10^{80}:\\
\;\;\;\;\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{elif}\;y \le 2.176770691227919101745141942515187743385 \cdot 10^{233}:\\
\;\;\;\;a - \frac{y}{\left(x + t\right) + y} \cdot b\\

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

\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 r561424 = x;
        double r561425 = y;
        double r561426 = r561424 + r561425;
        double r561427 = z;
        double r561428 = r561426 * r561427;
        double r561429 = t;
        double r561430 = r561429 + r561425;
        double r561431 = a;
        double r561432 = r561430 * r561431;
        double r561433 = r561428 + r561432;
        double r561434 = b;
        double r561435 = r561425 * r561434;
        double r561436 = r561433 - r561435;
        double r561437 = r561424 + r561429;
        double r561438 = r561437 + r561425;
        double r561439 = r561436 / r561438;
        return r561439;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r561440 = y;
        double r561441 = -1.0806850726955622e+214;
        bool r561442 = r561440 <= r561441;
        double r561443 = z;
        double r561444 = x;
        double r561445 = t;
        double r561446 = r561444 + r561445;
        double r561447 = r561446 + r561440;
        double r561448 = r561440 / r561447;
        double r561449 = b;
        double r561450 = r561448 * r561449;
        double r561451 = r561443 - r561450;
        double r561452 = -1.9770205152967977e+65;
        bool r561453 = r561440 <= r561452;
        double r561454 = a;
        double r561455 = r561454 - r561450;
        double r561456 = 4.258714344896704e+80;
        bool r561457 = r561440 <= r561456;
        double r561458 = 1.0;
        double r561459 = r561444 + r561440;
        double r561460 = r561459 * r561443;
        double r561461 = r561445 + r561440;
        double r561462 = r561461 * r561454;
        double r561463 = r561460 + r561462;
        double r561464 = r561440 * r561449;
        double r561465 = r561463 - r561464;
        double r561466 = r561447 / r561465;
        double r561467 = r561458 / r561466;
        double r561468 = 2.176770691227919e+233;
        bool r561469 = r561440 <= r561468;
        double r561470 = 3.982002360183062e+263;
        bool r561471 = r561440 <= r561470;
        double r561472 = r561471 ? r561451 : r561455;
        double r561473 = r561469 ? r561455 : r561472;
        double r561474 = r561457 ? r561467 : r561473;
        double r561475 = r561453 ? r561455 : r561474;
        double r561476 = r561442 ? r561451 : r561475;
        return r561476;
}

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.8
Target11.5
Herbie19.7
\[\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 y < -1.0806850726955622e+214 or 2.176770691227919e+233 < y < 3.982002360183062e+263

    1. Initial program 52.9

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

      \[\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*45.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. Using strategy rm
    7. Applied associate-/r/43.6

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

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

    if -1.0806850726955622e+214 < y < -1.9770205152967977e+65 or 4.258714344896704e+80 < y < 2.176770691227919e+233 or 3.982002360183062e+263 < y

    1. Initial program 40.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-sub40.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*33.3

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

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

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

    if -1.9770205152967977e+65 < y < 4.258714344896704e+80

    1. Initial program 16.5

      \[\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 clear-num16.6

      \[\leadsto \color{blue}{\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}}}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification19.7

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \le -1.080685072695562236595787579237443788954 \cdot 10^{214}:\\ \;\;\;\;z - \frac{y}{\left(x + t\right) + y} \cdot b\\ \mathbf{elif}\;y \le -1.9770205152967976990982926348554284473 \cdot 10^{65}:\\ \;\;\;\;a - \frac{y}{\left(x + t\right) + y} \cdot b\\ \mathbf{elif}\;y \le 4.258714344896704138558189467068963913256 \cdot 10^{80}:\\ \;\;\;\;\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{elif}\;y \le 2.176770691227919101745141942515187743385 \cdot 10^{233}:\\ \;\;\;\;a - \frac{y}{\left(x + t\right) + y} \cdot b\\ \mathbf{elif}\;y \le 3.982002360183062272030533575745070819145 \cdot 10^{263}:\\ \;\;\;\;z - \frac{y}{\left(x + t\right) + y} \cdot b\\ \mathbf{else}:\\ \;\;\;\;a - \frac{y}{\left(x + t\right) + y} \cdot b\\ \end{array}\]

Reproduce

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