Average Error: 26.5 → 18.0
Time: 15.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}\;a \le -4.3473990959534402764208566333360926031 \cdot 10^{77} \lor \neg \left(a \le -3.937317057993329361148574628999906763686 \cdot 10^{-300}\right) \land \left(a \le 7.190504744030888873233099096412658089532 \cdot 10^{-167} \lor \neg \left(a \le 639976741042962656679682639921152\right)\right):\\ \;\;\;\;\left(z - y \cdot \frac{b}{y + \left(x + t\right)}\right) + a\\ \mathbf{else}:\\ \;\;\;\;\frac{a \cdot \left(y + t\right) + z \cdot \left(y + x\right)}{x + \left(y + t\right)} - \frac{1}{\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}\;a \le -4.3473990959534402764208566333360926031 \cdot 10^{77} \lor \neg \left(a \le -3.937317057993329361148574628999906763686 \cdot 10^{-300}\right) \land \left(a \le 7.190504744030888873233099096412658089532 \cdot 10^{-167} \lor \neg \left(a \le 639976741042962656679682639921152\right)\right):\\
\;\;\;\;\left(z - y \cdot \frac{b}{y + \left(x + t\right)}\right) + a\\

\mathbf{else}:\\
\;\;\;\;\frac{a \cdot \left(y + t\right) + z \cdot \left(y + x\right)}{x + \left(y + t\right)} - \frac{1}{\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 r688151 = x;
        double r688152 = y;
        double r688153 = r688151 + r688152;
        double r688154 = z;
        double r688155 = r688153 * r688154;
        double r688156 = t;
        double r688157 = r688156 + r688152;
        double r688158 = a;
        double r688159 = r688157 * r688158;
        double r688160 = r688155 + r688159;
        double r688161 = b;
        double r688162 = r688152 * r688161;
        double r688163 = r688160 - r688162;
        double r688164 = r688151 + r688156;
        double r688165 = r688164 + r688152;
        double r688166 = r688163 / r688165;
        return r688166;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r688167 = a;
        double r688168 = -4.3473990959534403e+77;
        bool r688169 = r688167 <= r688168;
        double r688170 = -3.9373170579933294e-300;
        bool r688171 = r688167 <= r688170;
        double r688172 = !r688171;
        double r688173 = 7.190504744030889e-167;
        bool r688174 = r688167 <= r688173;
        double r688175 = 6.3997674104296266e+32;
        bool r688176 = r688167 <= r688175;
        double r688177 = !r688176;
        bool r688178 = r688174 || r688177;
        bool r688179 = r688172 && r688178;
        bool r688180 = r688169 || r688179;
        double r688181 = z;
        double r688182 = y;
        double r688183 = b;
        double r688184 = x;
        double r688185 = t;
        double r688186 = r688184 + r688185;
        double r688187 = r688182 + r688186;
        double r688188 = r688183 / r688187;
        double r688189 = r688182 * r688188;
        double r688190 = r688181 - r688189;
        double r688191 = r688190 + r688167;
        double r688192 = r688182 + r688185;
        double r688193 = r688167 * r688192;
        double r688194 = r688182 + r688184;
        double r688195 = r688181 * r688194;
        double r688196 = r688193 + r688195;
        double r688197 = r688184 + r688192;
        double r688198 = r688196 / r688197;
        double r688199 = 1.0;
        double r688200 = r688187 / r688182;
        double r688201 = r688199 / r688200;
        double r688202 = r688201 * r688183;
        double r688203 = r688198 - r688202;
        double r688204 = r688180 ? r688191 : r688203;
        return r688204;
}

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.5
Target11.0
Herbie18.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.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 2 regimes
  2. if a < -4.3473990959534403e+77 or -3.9373170579933294e-300 < a < 7.190504744030889e-167 or 6.3997674104296266e+32 < a

    1. Initial program 33.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. Using strategy rm
    3. Applied div-sub33.2

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

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

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

      \[\leadsto \color{blue}{\left(a + z\right)} - \frac{b}{\frac{x + \left(y + t\right)}{y}}\]
    7. Using strategy rm
    8. Applied associate--l+19.9

      \[\leadsto \color{blue}{a + \left(z - \frac{b}{\frac{x + \left(y + t\right)}{y}}\right)}\]
    9. Simplified20.7

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

    if -4.3473990959534403e+77 < a < -3.9373170579933294e-300 or 7.190504744030889e-167 < a < 6.3997674104296266e+32

    1. Initial program 19.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. Using strategy rm
    3. Applied div-sub19.0

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

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

      \[\leadsto \frac{\left(y + t\right) \cdot a + \left(y + x\right) \cdot z}{x + \left(y + t\right)} - \color{blue}{\frac{b}{\frac{x + \left(y + t\right)}{y}}}\]
    6. Using strategy rm
    7. Applied div-inv14.8

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \le -4.3473990959534402764208566333360926031 \cdot 10^{77} \lor \neg \left(a \le -3.937317057993329361148574628999906763686 \cdot 10^{-300}\right) \land \left(a \le 7.190504744030888873233099096412658089532 \cdot 10^{-167} \lor \neg \left(a \le 639976741042962656679682639921152\right)\right):\\ \;\;\;\;\left(z - y \cdot \frac{b}{y + \left(x + t\right)}\right) + a\\ \mathbf{else}:\\ \;\;\;\;\frac{a \cdot \left(y + t\right) + z \cdot \left(y + x\right)}{x + \left(y + t\right)} - \frac{1}{\frac{y + \left(x + t\right)}{y}} \cdot b\\ \end{array}\]

Reproduce

herbie shell --seed 2019194 
(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.0 (/ (+ (+ 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)))