Average Error: 24.5 → 21.6
Time: 13.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}\;a \le -1.1340712208281114 \cdot 10^{+160}:\\ \;\;\;\;a\\ \mathbf{elif}\;a \le 3.0015568359160643 \cdot 10^{+184}:\\ \;\;\;\;\left(x \cdot z - \left(\left(b - z\right) \cdot y - \left(t + y\right) \cdot a\right)\right) \cdot \frac{1}{\left(t + y\right) + x}\\ \mathbf{else}:\\ \;\;\;\;a\\ \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.1340712208281114 \cdot 10^{+160}:\\
\;\;\;\;a\\

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

\mathbf{else}:\\
\;\;\;\;a\\

\end{array}
double f(double x, double y, double z, double t, double a, double b) {
        double r16789951 = x;
        double r16789952 = y;
        double r16789953 = r16789951 + r16789952;
        double r16789954 = z;
        double r16789955 = r16789953 * r16789954;
        double r16789956 = t;
        double r16789957 = r16789956 + r16789952;
        double r16789958 = a;
        double r16789959 = r16789957 * r16789958;
        double r16789960 = r16789955 + r16789959;
        double r16789961 = b;
        double r16789962 = r16789952 * r16789961;
        double r16789963 = r16789960 - r16789962;
        double r16789964 = r16789951 + r16789956;
        double r16789965 = r16789964 + r16789952;
        double r16789966 = r16789963 / r16789965;
        return r16789966;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r16789967 = a;
        double r16789968 = -1.1340712208281114e+160;
        bool r16789969 = r16789967 <= r16789968;
        double r16789970 = 3.0015568359160643e+184;
        bool r16789971 = r16789967 <= r16789970;
        double r16789972 = x;
        double r16789973 = z;
        double r16789974 = r16789972 * r16789973;
        double r16789975 = b;
        double r16789976 = r16789975 - r16789973;
        double r16789977 = y;
        double r16789978 = r16789976 * r16789977;
        double r16789979 = t;
        double r16789980 = r16789979 + r16789977;
        double r16789981 = r16789980 * r16789967;
        double r16789982 = r16789978 - r16789981;
        double r16789983 = r16789974 - r16789982;
        double r16789984 = 1.0;
        double r16789985 = r16789980 + r16789972;
        double r16789986 = r16789984 / r16789985;
        double r16789987 = r16789983 * r16789986;
        double r16789988 = r16789971 ? r16789987 : r16789967;
        double r16789989 = r16789969 ? r16789967 : r16789988;
        return r16789989;
}

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
Target10.7
Herbie21.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 2 regimes
  2. if a < -1.1340712208281114e+160 or 3.0015568359160643e+184 < a

    1. Initial program 39.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. Taylor expanded around 0 26.4

      \[\leadsto \color{blue}{a}\]

    if -1.1340712208281114e+160 < a < 3.0015568359160643e+184

    1. Initial program 20.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. Simplified20.2

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

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

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

Reproduce

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