Average Error: 25.5 → 15.8
Time: 19.1s
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.3749133523278352 \cdot 10^{+123}:\\ \;\;\;\;\left(a + z\right) - b\\ \mathbf{elif}\;y \le 1.2649927179778784 \cdot 10^{+111}:\\ \;\;\;\;\frac{a \cdot \left(y + t\right) + \left(\left(x + y\right) \cdot z - y \cdot b\right)}{\left(y + t\right) + x}\\ \mathbf{else}:\\ \;\;\;\;\left(a + z\right) - 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}\;y \le -2.3749133523278352 \cdot 10^{+123}:\\
\;\;\;\;\left(a + z\right) - b\\

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

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

\end{array}
double f(double x, double y, double z, double t, double a, double b) {
        double r43934605 = x;
        double r43934606 = y;
        double r43934607 = r43934605 + r43934606;
        double r43934608 = z;
        double r43934609 = r43934607 * r43934608;
        double r43934610 = t;
        double r43934611 = r43934610 + r43934606;
        double r43934612 = a;
        double r43934613 = r43934611 * r43934612;
        double r43934614 = r43934609 + r43934613;
        double r43934615 = b;
        double r43934616 = r43934606 * r43934615;
        double r43934617 = r43934614 - r43934616;
        double r43934618 = r43934605 + r43934610;
        double r43934619 = r43934618 + r43934606;
        double r43934620 = r43934617 / r43934619;
        return r43934620;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r43934621 = y;
        double r43934622 = -2.3749133523278352e+123;
        bool r43934623 = r43934621 <= r43934622;
        double r43934624 = a;
        double r43934625 = z;
        double r43934626 = r43934624 + r43934625;
        double r43934627 = b;
        double r43934628 = r43934626 - r43934627;
        double r43934629 = 1.2649927179778784e+111;
        bool r43934630 = r43934621 <= r43934629;
        double r43934631 = t;
        double r43934632 = r43934621 + r43934631;
        double r43934633 = r43934624 * r43934632;
        double r43934634 = x;
        double r43934635 = r43934634 + r43934621;
        double r43934636 = r43934635 * r43934625;
        double r43934637 = r43934621 * r43934627;
        double r43934638 = r43934636 - r43934637;
        double r43934639 = r43934633 + r43934638;
        double r43934640 = r43934632 + r43934634;
        double r43934641 = r43934639 / r43934640;
        double r43934642 = r43934630 ? r43934641 : r43934628;
        double r43934643 = r43934623 ? r43934628 : r43934642;
        return r43934643;
}

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

Original25.5
Target11.0
Herbie15.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 2 regimes
  2. if y < -2.3749133523278352e+123 or 1.2649927179778784e+111 < y

    1. Initial program 44.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. Simplified44.2

      \[\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. Taylor expanded around inf 12.9

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

    if -2.3749133523278352e+123 < y < 1.2649927179778784e+111

    1. Initial program 17.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. Simplified17.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. Taylor expanded around inf 17.1

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

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

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

Reproduce

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