Average Error: 24.9 → 16.8
Time: 19.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 -2.894955572700637 \cdot 10^{+43}:\\ \;\;\;\;\left(z + a\right) - b \cdot \frac{y}{\left(t + y\right) + x}\\ \mathbf{elif}\;a \le -8.234919045173266 \cdot 10^{-138}:\\ \;\;\;\;\frac{z \cdot \left(x + y\right) + \left(t + y\right) \cdot a}{\left(t + y\right) + x} - b \cdot \frac{y}{\left(t + y\right) + x}\\ \mathbf{elif}\;a \le -1.1722878479406442 \cdot 10^{-195}:\\ \;\;\;\;z - b \cdot \frac{y}{\left(t + y\right) + x}\\ \mathbf{elif}\;a \le 5.907781539963392 \cdot 10^{+58}:\\ \;\;\;\;\frac{z \cdot \left(x + y\right) + \left(t + y\right) \cdot a}{\left(t + y\right) + x} - b \cdot \frac{y}{\left(t + y\right) + x}\\ \mathbf{else}:\\ \;\;\;\;\left(z + a\right) - b \cdot \frac{y}{\left(t + y\right) + x}\\ \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 -2.894955572700637 \cdot 10^{+43}:\\
\;\;\;\;\left(z + a\right) - b \cdot \frac{y}{\left(t + y\right) + x}\\

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

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

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

\mathbf{else}:\\
\;\;\;\;\left(z + a\right) - b \cdot \frac{y}{\left(t + y\right) + x}\\

\end{array}
double f(double x, double y, double z, double t, double a, double b) {
        double r46174260 = x;
        double r46174261 = y;
        double r46174262 = r46174260 + r46174261;
        double r46174263 = z;
        double r46174264 = r46174262 * r46174263;
        double r46174265 = t;
        double r46174266 = r46174265 + r46174261;
        double r46174267 = a;
        double r46174268 = r46174266 * r46174267;
        double r46174269 = r46174264 + r46174268;
        double r46174270 = b;
        double r46174271 = r46174261 * r46174270;
        double r46174272 = r46174269 - r46174271;
        double r46174273 = r46174260 + r46174265;
        double r46174274 = r46174273 + r46174261;
        double r46174275 = r46174272 / r46174274;
        return r46174275;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r46174276 = a;
        double r46174277 = -2.894955572700637e+43;
        bool r46174278 = r46174276 <= r46174277;
        double r46174279 = z;
        double r46174280 = r46174279 + r46174276;
        double r46174281 = b;
        double r46174282 = y;
        double r46174283 = t;
        double r46174284 = r46174283 + r46174282;
        double r46174285 = x;
        double r46174286 = r46174284 + r46174285;
        double r46174287 = r46174282 / r46174286;
        double r46174288 = r46174281 * r46174287;
        double r46174289 = r46174280 - r46174288;
        double r46174290 = -8.234919045173266e-138;
        bool r46174291 = r46174276 <= r46174290;
        double r46174292 = r46174285 + r46174282;
        double r46174293 = r46174279 * r46174292;
        double r46174294 = r46174284 * r46174276;
        double r46174295 = r46174293 + r46174294;
        double r46174296 = r46174295 / r46174286;
        double r46174297 = r46174296 - r46174288;
        double r46174298 = -1.1722878479406442e-195;
        bool r46174299 = r46174276 <= r46174298;
        double r46174300 = r46174279 - r46174288;
        double r46174301 = 5.907781539963392e+58;
        bool r46174302 = r46174276 <= r46174301;
        double r46174303 = r46174302 ? r46174297 : r46174289;
        double r46174304 = r46174299 ? r46174300 : r46174303;
        double r46174305 = r46174291 ? r46174297 : r46174304;
        double r46174306 = r46174278 ? r46174289 : r46174305;
        return r46174306;
}

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

Original24.9
Target11.4
Herbie16.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 3 regimes
  2. if a < -2.894955572700637e+43 or 5.907781539963392e+58 < a

    1. Initial program 34.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. Simplified34.4

      \[\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. Using strategy rm
    4. Applied associate-+r-34.4

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

      \[\leadsto \color{blue}{\frac{\left(y + t\right) \cdot a + z \cdot \left(x + y\right)}{x + \left(y + t\right)} - \frac{b \cdot y}{x + \left(y + t\right)}}\]
    6. Using strategy rm
    7. Applied *-un-lft-identity34.4

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

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

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

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

    if -2.894955572700637e+43 < a < -8.234919045173266e-138 or -1.1722878479406442e-195 < a < 5.907781539963392e+58

    1. Initial program 17.7

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

      \[\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. Using strategy rm
    4. Applied associate-+r-17.7

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

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

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

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

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

    if -8.234919045173266e-138 < a < -1.1722878479406442e-195

    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. Simplified20.3

      \[\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. Using strategy rm
    4. Applied associate-+r-20.3

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

      \[\leadsto \color{blue}{\frac{\left(y + t\right) \cdot a + z \cdot \left(x + y\right)}{x + \left(y + t\right)} - \frac{b \cdot y}{x + \left(y + t\right)}}\]
    6. Using strategy rm
    7. Applied *-un-lft-identity20.3

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \le -2.894955572700637 \cdot 10^{+43}:\\ \;\;\;\;\left(z + a\right) - b \cdot \frac{y}{\left(t + y\right) + x}\\ \mathbf{elif}\;a \le -8.234919045173266 \cdot 10^{-138}:\\ \;\;\;\;\frac{z \cdot \left(x + y\right) + \left(t + y\right) \cdot a}{\left(t + y\right) + x} - b \cdot \frac{y}{\left(t + y\right) + x}\\ \mathbf{elif}\;a \le -1.1722878479406442 \cdot 10^{-195}:\\ \;\;\;\;z - b \cdot \frac{y}{\left(t + y\right) + x}\\ \mathbf{elif}\;a \le 5.907781539963392 \cdot 10^{+58}:\\ \;\;\;\;\frac{z \cdot \left(x + y\right) + \left(t + y\right) \cdot a}{\left(t + y\right) + x} - b \cdot \frac{y}{\left(t + y\right) + x}\\ \mathbf{else}:\\ \;\;\;\;\left(z + a\right) - b \cdot \frac{y}{\left(t + y\right) + x}\\ \end{array}\]

Reproduce

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