Average Error: 25.7 → 16.0
Time: 19.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}\;y \le -8.350665119324792 \cdot 10^{+143}:\\ \;\;\;\;\left(a + z\right) - b\\ \mathbf{elif}\;y \le 2.3518001946314524 \cdot 10^{+68}:\\ \;\;\;\;\frac{\left(\left(x + y\right) \cdot z + a \cdot \left(y + t\right)\right) - y \cdot b}{x + \left(y + t\right)}\\ \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 -8.350665119324792 \cdot 10^{+143}:\\
\;\;\;\;\left(a + z\right) - b\\

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

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

\end{array}
double f(double x, double y, double z, double t, double a, double b) {
        double r41940112 = x;
        double r41940113 = y;
        double r41940114 = r41940112 + r41940113;
        double r41940115 = z;
        double r41940116 = r41940114 * r41940115;
        double r41940117 = t;
        double r41940118 = r41940117 + r41940113;
        double r41940119 = a;
        double r41940120 = r41940118 * r41940119;
        double r41940121 = r41940116 + r41940120;
        double r41940122 = b;
        double r41940123 = r41940113 * r41940122;
        double r41940124 = r41940121 - r41940123;
        double r41940125 = r41940112 + r41940117;
        double r41940126 = r41940125 + r41940113;
        double r41940127 = r41940124 / r41940126;
        return r41940127;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r41940128 = y;
        double r41940129 = -8.350665119324792e+143;
        bool r41940130 = r41940128 <= r41940129;
        double r41940131 = a;
        double r41940132 = z;
        double r41940133 = r41940131 + r41940132;
        double r41940134 = b;
        double r41940135 = r41940133 - r41940134;
        double r41940136 = 2.3518001946314524e+68;
        bool r41940137 = r41940128 <= r41940136;
        double r41940138 = x;
        double r41940139 = r41940138 + r41940128;
        double r41940140 = r41940139 * r41940132;
        double r41940141 = t;
        double r41940142 = r41940128 + r41940141;
        double r41940143 = r41940131 * r41940142;
        double r41940144 = r41940140 + r41940143;
        double r41940145 = r41940128 * r41940134;
        double r41940146 = r41940144 - r41940145;
        double r41940147 = r41940138 + r41940142;
        double r41940148 = r41940146 / r41940147;
        double r41940149 = r41940137 ? r41940148 : r41940135;
        double r41940150 = r41940130 ? r41940135 : r41940149;
        return r41940150;
}

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.7
Target11.7
Herbie16.0
\[\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 < -8.350665119324792e+143 or 2.3518001946314524e+68 < y

    1. Initial program 42.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. Simplified42.2

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

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

    if -8.350665119324792e+143 < y < 2.3518001946314524e+68

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

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

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

Reproduce

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