Average Error: 26.6 → 20.6
Time: 7.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}\;z \le -1.9324464993872985 \cdot 10^{161}:\\ \;\;\;\;z - \frac{y}{\frac{\left(x + t\right) + y}{b}}\\ \mathbf{elif}\;z \le -3.21777700749054 \cdot 10^{-212}:\\ \;\;\;\;\frac{{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right)}^{1}}{\left(x + t\right) + y} - \frac{y}{\left(x + t\right) + y} \cdot b\\ \mathbf{elif}\;z \le 4.9830269560747303 \cdot 10^{-230}:\\ \;\;\;\;a - \frac{y}{\frac{\left(x + t\right) + y}{b}}\\ \mathbf{elif}\;z \le 5.11133884308971345 \cdot 10^{-138}:\\ \;\;\;\;\frac{{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right)}^{1}}{\left(x + t\right) + y} - y \cdot \frac{b}{\left(x + t\right) + y}\\ \mathbf{elif}\;z \le 2.2961033508151134 \cdot 10^{-92}:\\ \;\;\;\;a - \frac{y}{\frac{\left(x + t\right) + y}{b}}\\ \mathbf{elif}\;z \le 2.02082285385241078 \cdot 10^{-10}:\\ \;\;\;\;\frac{{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right)}^{1}}{\left(x + t\right) + y} - \frac{y}{\left(x + t\right) + y} \cdot b\\ \mathbf{elif}\;z \le 2688.7700160430627:\\ \;\;\;\;a - \frac{y}{\frac{\left(x + t\right) + y}{b}}\\ \mathbf{elif}\;z \le 3.8981084817894228 \cdot 10^{118}:\\ \;\;\;\;\frac{{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right)}^{1}}{\left(x + t\right) + y} - y \cdot \frac{b}{\left(x + t\right) + y}\\ \mathbf{else}:\\ \;\;\;\;z - \frac{y}{\frac{\left(x + t\right) + y}{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}\;z \le -1.9324464993872985 \cdot 10^{161}:\\
\;\;\;\;z - \frac{y}{\frac{\left(x + t\right) + y}{b}}\\

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

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

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

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

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

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

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

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

\end{array}
double code(double x, double y, double z, double t, double a, double b) {
	return (((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y));
}
double code(double x, double y, double z, double t, double a, double b) {
	double temp;
	if ((z <= -1.9324464993872985e+161)) {
		temp = (z - (y / (((x + t) + y) / b)));
	} else {
		double temp_1;
		if ((z <= -3.21777700749054e-212)) {
			temp_1 = ((pow((((x + y) * z) + ((t + y) * a)), 1.0) / ((x + t) + y)) - ((y / ((x + t) + y)) * b));
		} else {
			double temp_2;
			if ((z <= 4.98302695607473e-230)) {
				temp_2 = (a - (y / (((x + t) + y) / b)));
			} else {
				double temp_3;
				if ((z <= 5.1113388430897134e-138)) {
					temp_3 = ((pow((((x + y) * z) + ((t + y) * a)), 1.0) / ((x + t) + y)) - (y * (b / ((x + t) + y))));
				} else {
					double temp_4;
					if ((z <= 2.2961033508151134e-92)) {
						temp_4 = (a - (y / (((x + t) + y) / b)));
					} else {
						double temp_5;
						if ((z <= 2.0208228538524108e-10)) {
							temp_5 = ((pow((((x + y) * z) + ((t + y) * a)), 1.0) / ((x + t) + y)) - ((y / ((x + t) + y)) * b));
						} else {
							double temp_6;
							if ((z <= 2688.7700160430627)) {
								temp_6 = (a - (y / (((x + t) + y) / b)));
							} else {
								double temp_7;
								if ((z <= 3.898108481789423e+118)) {
									temp_7 = ((pow((((x + y) * z) + ((t + y) * a)), 1.0) / ((x + t) + y)) - (y * (b / ((x + t) + y))));
								} else {
									temp_7 = (z - (y / (((x + t) + y) / b)));
								}
								temp_6 = temp_7;
							}
							temp_5 = temp_6;
						}
						temp_4 = temp_5;
					}
					temp_3 = temp_4;
				}
				temp_2 = temp_3;
			}
			temp_1 = temp_2;
		}
		temp = temp_1;
	}
	return temp;
}

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

Original26.6
Target11.5
Herbie20.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 4 regimes
  2. if z < -1.9324464993872985e+161 or 3.898108481789423e+118 < z

    1. Initial program 40.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. Using strategy rm
    3. Applied pow140.7

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

      \[\leadsto \color{blue}{\frac{{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right)}^{1}}{\left(x + t\right) + y} - \frac{y \cdot b}{\left(x + t\right) + y}}\]
    6. Using strategy rm
    7. Applied associate-/l*40.7

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

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

    if -1.9324464993872985e+161 < z < -3.21777700749054e-212 or 2.2961033508151134e-92 < z < 2.0208228538524108e-10

    1. Initial program 21.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 pow121.8

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

      \[\leadsto \color{blue}{\frac{{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right)}^{1}}{\left(x + t\right) + y} - \frac{y \cdot b}{\left(x + t\right) + y}}\]
    6. Using strategy rm
    7. Applied associate-/l*18.8

      \[\leadsto \frac{{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right)}^{1}}{\left(x + t\right) + y} - \color{blue}{\frac{y}{\frac{\left(x + t\right) + y}{b}}}\]
    8. Using strategy rm
    9. Applied associate-/r/18.1

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

    if -3.21777700749054e-212 < z < 4.98302695607473e-230 or 5.1113388430897134e-138 < z < 2.2961033508151134e-92 or 2.0208228538524108e-10 < z < 2688.7700160430627

    1. Initial program 19.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. Using strategy rm
    3. Applied pow119.7

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

      \[\leadsto \color{blue}{\frac{{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right)}^{1}}{\left(x + t\right) + y} - \frac{y \cdot b}{\left(x + t\right) + y}}\]
    6. Using strategy rm
    7. Applied associate-/l*17.1

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

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

    if 4.98302695607473e-230 < z < 5.1113388430897134e-138 or 2688.7700160430627 < z < 3.898108481789423e+118

    1. Initial program 22.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. Using strategy rm
    3. Applied pow122.0

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le -1.9324464993872985 \cdot 10^{161}:\\ \;\;\;\;z - \frac{y}{\frac{\left(x + t\right) + y}{b}}\\ \mathbf{elif}\;z \le -3.21777700749054 \cdot 10^{-212}:\\ \;\;\;\;\frac{{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right)}^{1}}{\left(x + t\right) + y} - \frac{y}{\left(x + t\right) + y} \cdot b\\ \mathbf{elif}\;z \le 4.9830269560747303 \cdot 10^{-230}:\\ \;\;\;\;a - \frac{y}{\frac{\left(x + t\right) + y}{b}}\\ \mathbf{elif}\;z \le 5.11133884308971345 \cdot 10^{-138}:\\ \;\;\;\;\frac{{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right)}^{1}}{\left(x + t\right) + y} - y \cdot \frac{b}{\left(x + t\right) + y}\\ \mathbf{elif}\;z \le 2.2961033508151134 \cdot 10^{-92}:\\ \;\;\;\;a - \frac{y}{\frac{\left(x + t\right) + y}{b}}\\ \mathbf{elif}\;z \le 2.02082285385241078 \cdot 10^{-10}:\\ \;\;\;\;\frac{{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right)}^{1}}{\left(x + t\right) + y} - \frac{y}{\left(x + t\right) + y} \cdot b\\ \mathbf{elif}\;z \le 2688.7700160430627:\\ \;\;\;\;a - \frac{y}{\frac{\left(x + t\right) + y}{b}}\\ \mathbf{elif}\;z \le 3.8981084817894228 \cdot 10^{118}:\\ \;\;\;\;\frac{{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right)}^{1}}{\left(x + t\right) + y} - y \cdot \frac{b}{\left(x + t\right) + y}\\ \mathbf{else}:\\ \;\;\;\;z - \frac{y}{\frac{\left(x + t\right) + y}{b}}\\ \end{array}\]

Reproduce

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