Average Error: 24.5 → 12.4
Time: 18.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}\;y \le -2.9724483350448765 \cdot 10^{-25}:\\ \;\;\;\;\left(a + z\right) - \frac{b}{\frac{\left(y + t\right) + x}{y}}\\ \mathbf{elif}\;y \le 129142155513.06804:\\ \;\;\;\;\frac{1}{\left(y + t\right) + x} \cdot \left(z \cdot \left(y + x\right) + a \cdot \left(y + t\right)\right) - \frac{y \cdot b}{\left(y + t\right) + x}\\ \mathbf{else}:\\ \;\;\;\;\left(a + z\right) - \frac{b}{\frac{\left(y + t\right) + x}{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}\;y \le -2.9724483350448765 \cdot 10^{-25}:\\
\;\;\;\;\left(a + z\right) - \frac{b}{\frac{\left(y + t\right) + x}{y}}\\

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

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

\end{array}
double f(double x, double y, double z, double t, double a, double b) {
        double r43196322 = x;
        double r43196323 = y;
        double r43196324 = r43196322 + r43196323;
        double r43196325 = z;
        double r43196326 = r43196324 * r43196325;
        double r43196327 = t;
        double r43196328 = r43196327 + r43196323;
        double r43196329 = a;
        double r43196330 = r43196328 * r43196329;
        double r43196331 = r43196326 + r43196330;
        double r43196332 = b;
        double r43196333 = r43196323 * r43196332;
        double r43196334 = r43196331 - r43196333;
        double r43196335 = r43196322 + r43196327;
        double r43196336 = r43196335 + r43196323;
        double r43196337 = r43196334 / r43196336;
        return r43196337;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r43196338 = y;
        double r43196339 = -2.9724483350448765e-25;
        bool r43196340 = r43196338 <= r43196339;
        double r43196341 = a;
        double r43196342 = z;
        double r43196343 = r43196341 + r43196342;
        double r43196344 = b;
        double r43196345 = t;
        double r43196346 = r43196338 + r43196345;
        double r43196347 = x;
        double r43196348 = r43196346 + r43196347;
        double r43196349 = r43196348 / r43196338;
        double r43196350 = r43196344 / r43196349;
        double r43196351 = r43196343 - r43196350;
        double r43196352 = 129142155513.06804;
        bool r43196353 = r43196338 <= r43196352;
        double r43196354 = 1.0;
        double r43196355 = r43196354 / r43196348;
        double r43196356 = r43196338 + r43196347;
        double r43196357 = r43196342 * r43196356;
        double r43196358 = r43196341 * r43196346;
        double r43196359 = r43196357 + r43196358;
        double r43196360 = r43196355 * r43196359;
        double r43196361 = r43196338 * r43196344;
        double r43196362 = r43196361 / r43196348;
        double r43196363 = r43196360 - r43196362;
        double r43196364 = r43196353 ? r43196363 : r43196351;
        double r43196365 = r43196340 ? r43196351 : r43196364;
        return r43196365;
}

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.5
Target11.6
Herbie12.4
\[\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.9724483350448765e-25 or 129142155513.06804 < y

    1. Initial program 35.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. Simplified35.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. Using strategy rm
    4. Applied associate-+r-35.0

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

      \[\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 associate-/l*28.2

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

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

    if -2.9724483350448765e-25 < y < 129142155513.06804

    1. Initial program 13.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. Simplified13.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-13.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-sub13.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 div-inv13.8

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

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

Reproduce

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