Average Error: 25.5 → 15.8
Time: 18.5s
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 -2.3749133523278352 \cdot 10^{+123}:\\ \;\;\;\;\left(a + z\right) - b\\ \mathbf{elif}\;y \le 1.2649927179778784 \cdot 10^{+111}:\\ \;\;\;\;\frac{a \cdot \left(y + t\right) + \left(\left(x + y\right) \cdot z - y \cdot b\right)}{\left(y + t\right) + x}\\ \mathbf{else}:\\ \;\;\;\;\left(a + z\right) - 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 -2.3749133523278352 \cdot 10^{+123}:\\
\;\;\;\;\left(a + z\right) - b\\

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

\mathbf{else}:\\
\;\;\;\;\left(a + z\right) - b\\

\end{array}
double f(double x, double y, double z, double t, double a, double b) {
        double r41697522 = x;
        double r41697523 = y;
        double r41697524 = r41697522 + r41697523;
        double r41697525 = z;
        double r41697526 = r41697524 * r41697525;
        double r41697527 = t;
        double r41697528 = r41697527 + r41697523;
        double r41697529 = a;
        double r41697530 = r41697528 * r41697529;
        double r41697531 = r41697526 + r41697530;
        double r41697532 = b;
        double r41697533 = r41697523 * r41697532;
        double r41697534 = r41697531 - r41697533;
        double r41697535 = r41697522 + r41697527;
        double r41697536 = r41697535 + r41697523;
        double r41697537 = r41697534 / r41697536;
        return r41697537;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r41697538 = y;
        double r41697539 = -2.3749133523278352e+123;
        bool r41697540 = r41697538 <= r41697539;
        double r41697541 = a;
        double r41697542 = z;
        double r41697543 = r41697541 + r41697542;
        double r41697544 = b;
        double r41697545 = r41697543 - r41697544;
        double r41697546 = 1.2649927179778784e+111;
        bool r41697547 = r41697538 <= r41697546;
        double r41697548 = t;
        double r41697549 = r41697538 + r41697548;
        double r41697550 = r41697541 * r41697549;
        double r41697551 = x;
        double r41697552 = r41697551 + r41697538;
        double r41697553 = r41697552 * r41697542;
        double r41697554 = r41697538 * r41697544;
        double r41697555 = r41697553 - r41697554;
        double r41697556 = r41697550 + r41697555;
        double r41697557 = r41697549 + r41697551;
        double r41697558 = r41697556 / r41697557;
        double r41697559 = r41697547 ? r41697558 : r41697545;
        double r41697560 = r41697540 ? r41697545 : r41697559;
        return r41697560;
}

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

Original25.5
Target11.0
Herbie15.8
\[\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 2 regimes
  2. if y < -2.3749133523278352e+123 or 1.2649927179778784e+111 < y

    1. Initial program 44.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. Simplified44.2

      \[\leadsto \color{blue}{\frac{\left(y + t\right) \cdot a + \left(z \cdot \left(x + y\right) - b \cdot y\right)}{x + \left(y + t\right)}}\]
    3. Taylor expanded around inf 12.9

      \[\leadsto \color{blue}{\left(a + z\right) - b}\]

    if -2.3749133523278352e+123 < y < 1.2649927179778784e+111

    1. Initial program 17.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. Simplified17.0

      \[\leadsto \color{blue}{\frac{\left(y + t\right) \cdot a + \left(z \cdot \left(x + y\right) - b \cdot y\right)}{x + \left(y + t\right)}}\]
    3. Taylor expanded around inf 17.1

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \le -2.3749133523278352 \cdot 10^{+123}:\\ \;\;\;\;\left(a + z\right) - b\\ \mathbf{elif}\;y \le 1.2649927179778784 \cdot 10^{+111}:\\ \;\;\;\;\frac{a \cdot \left(y + t\right) + \left(\left(x + y\right) \cdot z - y \cdot b\right)}{\left(y + t\right) + x}\\ \mathbf{else}:\\ \;\;\;\;\left(a + z\right) - b\\ \end{array}\]

Reproduce

herbie shell --seed 2019163 
(FPCore (x y z t a b)
  :name "AI.Clustering.Hierarchical.Internal:ward from clustering-0.2.1"

  :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)))