Average Error: 26.3 → 20.6
Time: 22.0s
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.329351671379600395696054258455065074018 \cdot 10^{162}:\\ \;\;\;\;a - y \cdot \frac{b}{\left(x + t\right) + y}\\ \mathbf{elif}\;a \le 5.325165846082585887271445202627113987297 \cdot 10^{-212}:\\ \;\;\;\;\frac{\left(x + y\right) \cdot z + \left(t + y\right) \cdot a}{\left(x + t\right) + y} - \frac{y}{\sqrt[3]{\left(x + t\right) + y} \cdot \sqrt[3]{\left(x + t\right) + y}} \cdot \frac{b}{\sqrt[3]{\left(x + t\right) + y}}\\ \mathbf{elif}\;a \le 1.908584443905937974655168865478710611307 \cdot 10^{-45}:\\ \;\;\;\;z - y \cdot \frac{b}{\left(x + t\right) + y}\\ \mathbf{elif}\;a \le 1.978965818958528848241507275261864808485 \cdot 10^{164}:\\ \;\;\;\;\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 - y \cdot \frac{b}{\left(x + t\right) + y}\\ \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.329351671379600395696054258455065074018 \cdot 10^{162}:\\
\;\;\;\;a - y \cdot \frac{b}{\left(x + t\right) + y}\\

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

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

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

\end{array}
double f(double x, double y, double z, double t, double a, double b) {
        double r1475173 = x;
        double r1475174 = y;
        double r1475175 = r1475173 + r1475174;
        double r1475176 = z;
        double r1475177 = r1475175 * r1475176;
        double r1475178 = t;
        double r1475179 = r1475178 + r1475174;
        double r1475180 = a;
        double r1475181 = r1475179 * r1475180;
        double r1475182 = r1475177 + r1475181;
        double r1475183 = b;
        double r1475184 = r1475174 * r1475183;
        double r1475185 = r1475182 - r1475184;
        double r1475186 = r1475173 + r1475178;
        double r1475187 = r1475186 + r1475174;
        double r1475188 = r1475185 / r1475187;
        return r1475188;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r1475189 = a;
        double r1475190 = -1.3293516713796004e+162;
        bool r1475191 = r1475189 <= r1475190;
        double r1475192 = y;
        double r1475193 = b;
        double r1475194 = x;
        double r1475195 = t;
        double r1475196 = r1475194 + r1475195;
        double r1475197 = r1475196 + r1475192;
        double r1475198 = r1475193 / r1475197;
        double r1475199 = r1475192 * r1475198;
        double r1475200 = r1475189 - r1475199;
        double r1475201 = 5.325165846082586e-212;
        bool r1475202 = r1475189 <= r1475201;
        double r1475203 = r1475194 + r1475192;
        double r1475204 = z;
        double r1475205 = r1475203 * r1475204;
        double r1475206 = r1475195 + r1475192;
        double r1475207 = r1475206 * r1475189;
        double r1475208 = r1475205 + r1475207;
        double r1475209 = r1475208 / r1475197;
        double r1475210 = cbrt(r1475197);
        double r1475211 = r1475210 * r1475210;
        double r1475212 = r1475192 / r1475211;
        double r1475213 = r1475193 / r1475210;
        double r1475214 = r1475212 * r1475213;
        double r1475215 = r1475209 - r1475214;
        double r1475216 = 1.908584443905938e-45;
        bool r1475217 = r1475189 <= r1475216;
        double r1475218 = r1475204 - r1475199;
        double r1475219 = 1.9789658189585288e+164;
        bool r1475220 = r1475189 <= r1475219;
        double r1475221 = r1475197 / r1475193;
        double r1475222 = r1475192 / r1475221;
        double r1475223 = r1475209 - r1475222;
        double r1475224 = r1475220 ? r1475223 : r1475200;
        double r1475225 = r1475217 ? r1475218 : r1475224;
        double r1475226 = r1475202 ? r1475215 : r1475225;
        double r1475227 = r1475191 ? r1475200 : r1475226;
        return r1475227;
}

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.6
Herbie20.6
\[\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 4 regimes
  2. if a < -1.3293516713796004e+162 or 1.9789658189585288e+164 < a

    1. Initial program 42.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-sub42.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 *-un-lft-identity42.9

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

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

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

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

    if -1.3293516713796004e+162 < a < 5.325165846082586e-212

    1. Initial program 20.3

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

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

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

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

      \[\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. Using strategy rm
    9. Applied add-cube-cbrt17.7

      \[\leadsto \frac{\left(x + y\right) \cdot z + \left(t + y\right) \cdot a}{\left(x + t\right) + y} - y \cdot \frac{b}{\color{blue}{\left(\sqrt[3]{\left(x + t\right) + y} \cdot \sqrt[3]{\left(x + t\right) + y}\right) \cdot \sqrt[3]{\left(x + t\right) + y}}}\]
    10. Applied *-un-lft-identity17.7

      \[\leadsto \frac{\left(x + y\right) \cdot z + \left(t + y\right) \cdot a}{\left(x + t\right) + y} - y \cdot \frac{\color{blue}{1 \cdot b}}{\left(\sqrt[3]{\left(x + t\right) + y} \cdot \sqrt[3]{\left(x + t\right) + y}\right) \cdot \sqrt[3]{\left(x + t\right) + y}}\]
    11. Applied times-frac17.7

      \[\leadsto \frac{\left(x + y\right) \cdot z + \left(t + y\right) \cdot a}{\left(x + t\right) + y} - y \cdot \color{blue}{\left(\frac{1}{\sqrt[3]{\left(x + t\right) + y} \cdot \sqrt[3]{\left(x + t\right) + y}} \cdot \frac{b}{\sqrt[3]{\left(x + t\right) + y}}\right)}\]
    12. Applied associate-*r*16.9

      \[\leadsto \frac{\left(x + y\right) \cdot z + \left(t + y\right) \cdot a}{\left(x + t\right) + y} - \color{blue}{\left(y \cdot \frac{1}{\sqrt[3]{\left(x + t\right) + y} \cdot \sqrt[3]{\left(x + t\right) + y}}\right) \cdot \frac{b}{\sqrt[3]{\left(x + t\right) + y}}}\]
    13. Simplified16.9

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

    if 5.325165846082586e-212 < a < 1.908584443905938e-45

    1. Initial program 18.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 div-sub18.8

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

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

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

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

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

    if 1.908584443905938e-45 < a < 1.9789658189585288e+164

    1. Initial program 26.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-sub26.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*23.7

      \[\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}}}\]
  3. Recombined 4 regimes into one program.
  4. Final simplification20.6

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \le -1.329351671379600395696054258455065074018 \cdot 10^{162}:\\ \;\;\;\;a - y \cdot \frac{b}{\left(x + t\right) + y}\\ \mathbf{elif}\;a \le 5.325165846082585887271445202627113987297 \cdot 10^{-212}:\\ \;\;\;\;\frac{\left(x + y\right) \cdot z + \left(t + y\right) \cdot a}{\left(x + t\right) + y} - \frac{y}{\sqrt[3]{\left(x + t\right) + y} \cdot \sqrt[3]{\left(x + t\right) + y}} \cdot \frac{b}{\sqrt[3]{\left(x + t\right) + y}}\\ \mathbf{elif}\;a \le 1.908584443905937974655168865478710611307 \cdot 10^{-45}:\\ \;\;\;\;z - y \cdot \frac{b}{\left(x + t\right) + y}\\ \mathbf{elif}\;a \le 1.978965818958528848241507275261864808485 \cdot 10^{164}:\\ \;\;\;\;\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 - y \cdot \frac{b}{\left(x + t\right) + y}\\ \end{array}\]

Reproduce

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