Average Error: 27.0 → 22.6
Time: 6.2s
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}\;x \le -1.527978089724184 \cdot 10^{-170}:\\ \;\;\;\;\frac{\left(x + y\right) \cdot z + \left(t + y\right) \cdot a}{\left(x + t\right) + y} - \frac{1}{\frac{\left(x + t\right) + y}{y}} \cdot b\\ \mathbf{elif}\;x \le 4.9245467165626399 \cdot 10^{-78}:\\ \;\;\;\;a - \frac{y}{\left(x + t\right) + y} \cdot b\\ \mathbf{elif}\;x \le 5.5676276924920386 \cdot 10^{182}:\\ \;\;\;\;\frac{\left(x + y\right) \cdot z + \left(t + y\right) \cdot a}{\left(x + t\right) + y} - \frac{1}{\frac{\left(x + t\right) + y}{y}} \cdot b\\ \mathbf{else}:\\ \;\;\;\;z - \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}\;x \le -1.527978089724184 \cdot 10^{-170}:\\
\;\;\;\;\frac{\left(x + y\right) \cdot z + \left(t + y\right) \cdot a}{\left(x + t\right) + y} - \frac{1}{\frac{\left(x + t\right) + y}{y}} \cdot b\\

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

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

\mathbf{else}:\\
\;\;\;\;z - \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 r831608 = x;
        double r831609 = y;
        double r831610 = r831608 + r831609;
        double r831611 = z;
        double r831612 = r831610 * r831611;
        double r831613 = t;
        double r831614 = r831613 + r831609;
        double r831615 = a;
        double r831616 = r831614 * r831615;
        double r831617 = r831612 + r831616;
        double r831618 = b;
        double r831619 = r831609 * r831618;
        double r831620 = r831617 - r831619;
        double r831621 = r831608 + r831613;
        double r831622 = r831621 + r831609;
        double r831623 = r831620 / r831622;
        return r831623;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r831624 = x;
        double r831625 = -1.527978089724184e-170;
        bool r831626 = r831624 <= r831625;
        double r831627 = y;
        double r831628 = r831624 + r831627;
        double r831629 = z;
        double r831630 = r831628 * r831629;
        double r831631 = t;
        double r831632 = r831631 + r831627;
        double r831633 = a;
        double r831634 = r831632 * r831633;
        double r831635 = r831630 + r831634;
        double r831636 = r831624 + r831631;
        double r831637 = r831636 + r831627;
        double r831638 = r831635 / r831637;
        double r831639 = 1.0;
        double r831640 = r831637 / r831627;
        double r831641 = r831639 / r831640;
        double r831642 = b;
        double r831643 = r831641 * r831642;
        double r831644 = r831638 - r831643;
        double r831645 = 4.92454671656264e-78;
        bool r831646 = r831624 <= r831645;
        double r831647 = r831627 / r831637;
        double r831648 = r831647 * r831642;
        double r831649 = r831633 - r831648;
        double r831650 = 5.567627692492039e+182;
        bool r831651 = r831624 <= r831650;
        double r831652 = r831629 - r831648;
        double r831653 = r831651 ? r831644 : r831652;
        double r831654 = r831646 ? r831649 : r831653;
        double r831655 = r831626 ? r831644 : r831654;
        return r831655;
}

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

Original27.0
Target11.6
Herbie22.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.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 x < -1.527978089724184e-170 or 4.92454671656264e-78 < x < 5.567627692492039e+182

    1. Initial program 27.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-sub27.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 associate-/l*25.3

      \[\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}}}\]
    6. Using strategy rm
    7. Applied associate-/r/24.9

      \[\leadsto \frac{\left(x + y\right) \cdot z + \left(t + y\right) \cdot a}{\left(x + t\right) + y} - \color{blue}{\frac{y}{\left(x + t\right) + y} \cdot b}\]
    8. Using strategy rm
    9. Applied clear-num25.0

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

    if -1.527978089724184e-170 < x < 4.92454671656264e-78

    1. Initial program 21.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-sub21.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 associate-/l*20.2

      \[\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}}}\]
    6. Using strategy rm
    7. Applied associate-/r/18.1

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

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

    if 5.567627692492039e+182 < x

    1. Initial program 38.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-sub38.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 associate-/l*36.0

      \[\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}}}\]
    6. Using strategy rm
    7. Applied associate-/r/36.1

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -1.527978089724184 \cdot 10^{-170}:\\ \;\;\;\;\frac{\left(x + y\right) \cdot z + \left(t + y\right) \cdot a}{\left(x + t\right) + y} - \frac{1}{\frac{\left(x + t\right) + y}{y}} \cdot b\\ \mathbf{elif}\;x \le 4.9245467165626399 \cdot 10^{-78}:\\ \;\;\;\;a - \frac{y}{\left(x + t\right) + y} \cdot b\\ \mathbf{elif}\;x \le 5.5676276924920386 \cdot 10^{182}:\\ \;\;\;\;\frac{\left(x + y\right) \cdot z + \left(t + y\right) \cdot a}{\left(x + t\right) + y} - \frac{1}{\frac{\left(x + t\right) + y}{y}} \cdot b\\ \mathbf{else}:\\ \;\;\;\;z - \frac{y}{\left(x + t\right) + y} \cdot b\\ \end{array}\]

Reproduce

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