Average Error: 26.8 → 23.1
Time: 7.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.51042017274667401 \cdot 10^{171}:\\ \;\;\;\;z - \frac{y}{\frac{\left(x + t\right) + y}{b}}\\ \mathbf{elif}\;x \le -1.50708683770980189 \cdot 10^{134}:\\ \;\;\;\;\frac{1}{\frac{\left(x + t\right) + y}{\left(x + y\right) \cdot z + \left(t + y\right) \cdot a}} - \frac{y}{\frac{\left(x + t\right) + y}{b}}\\ \mathbf{elif}\;x \le -485115.40011078131:\\ \;\;\;\;z - \frac{y}{\frac{\left(x + t\right) + y}{b}}\\ \mathbf{elif}\;x \le -6.6876587271108054 \cdot 10^{-170}:\\ \;\;\;\;a - y \cdot \frac{b}{\left(x + t\right) + y}\\ \mathbf{elif}\;x \le -2.860753366813772 \cdot 10^{-271}:\\ \;\;\;\;\frac{1}{\left(x + t\right) + y} \cdot \left(\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b\right)\\ \mathbf{elif}\;x \le 6.7642958276510964 \cdot 10^{-203}:\\ \;\;\;\;a - y \cdot \frac{b}{\left(x + t\right) + y}\\ \mathbf{elif}\;x \le 9.7109844173215245 \cdot 10^{230}:\\ \;\;\;\;\frac{\left(x + y\right) \cdot z + \left(t + y\right) \cdot a}{\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}\;x \le -1.51042017274667401 \cdot 10^{171}:\\
\;\;\;\;z - \frac{y}{\frac{\left(x + t\right) + y}{b}}\\

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

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

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

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

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

\mathbf{elif}\;x \le 9.7109844173215245 \cdot 10^{230}:\\
\;\;\;\;\frac{\left(x + y\right) \cdot z + \left(t + y\right) \cdot a}{\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 ((x <= -1.510420172746674e+171)) {
		temp = (z - (y / (((x + t) + y) / b)));
	} else {
		double temp_1;
		if ((x <= -1.5070868377098019e+134)) {
			temp_1 = ((1.0 / (((x + t) + y) / (((x + y) * z) + ((t + y) * a)))) - (y / (((x + t) + y) / b)));
		} else {
			double temp_2;
			if ((x <= -485115.4001107813)) {
				temp_2 = (z - (y / (((x + t) + y) / b)));
			} else {
				double temp_3;
				if ((x <= -6.687658727110805e-170)) {
					temp_3 = (a - (y * (b / ((x + t) + y))));
				} else {
					double temp_4;
					if ((x <= -2.8607533668137723e-271)) {
						temp_4 = ((1.0 / ((x + t) + y)) * ((((x + y) * z) + ((t + y) * a)) - (y * b)));
					} else {
						double temp_5;
						if ((x <= 6.764295827651096e-203)) {
							temp_5 = (a - (y * (b / ((x + t) + y))));
						} else {
							double temp_6;
							if ((x <= 9.710984417321525e+230)) {
								temp_6 = (((((x + y) * z) + ((t + y) * a)) / ((x + t) + y)) - (y * (b / ((x + t) + y))));
							} else {
								temp_6 = (z - (y / (((x + t) + y) / b)));
							}
							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.8
Target10.8
Herbie23.1
\[\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 5 regimes
  2. if x < -1.510420172746674e+171 or -1.5070868377098019e+134 < x < -485115.4001107813 or 9.710984417321525e+230 < x

    1. Initial program 33.1

      \[\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-sub33.1

      \[\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*30.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. Taylor expanded around inf 23.8

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

    if -1.510420172746674e+171 < x < -1.5070868377098019e+134

    1. Initial program 31.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 div-sub31.7

      \[\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*29.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 clear-num29.2

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

    if -485115.4001107813 < x < -6.687658727110805e-170 or -2.8607533668137723e-271 < x < 6.764295827651096e-203

    1. Initial program 23.6

      \[\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-sub23.6

      \[\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 *-un-lft-identity23.6

      \[\leadsto \frac{\left(x + y\right) \cdot z + \left(t + y\right) \cdot a}{\left(x + t\right) + y} - \frac{y \cdot b}{\color{blue}{1 \cdot \left(\left(x + t\right) + y\right)}}\]
    6. Applied times-frac22.2

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

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

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

    if -6.687658727110805e-170 < x < -2.8607533668137723e-271

    1. Initial program 21.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 div-sub21.0

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

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

      \[\leadsto \color{blue}{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) \cdot \frac{1}{\left(x + t\right) + y}} - \left(y \cdot b\right) \cdot \frac{1}{\left(x + t\right) + y}\]
    7. Applied distribute-rgt-out--21.1

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

    if 6.764295827651096e-203 < x < 9.710984417321525e+230

    1. Initial program 25.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 div-sub25.0

      \[\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 *-un-lft-identity25.0

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -1.51042017274667401 \cdot 10^{171}:\\ \;\;\;\;z - \frac{y}{\frac{\left(x + t\right) + y}{b}}\\ \mathbf{elif}\;x \le -1.50708683770980189 \cdot 10^{134}:\\ \;\;\;\;\frac{1}{\frac{\left(x + t\right) + y}{\left(x + y\right) \cdot z + \left(t + y\right) \cdot a}} - \frac{y}{\frac{\left(x + t\right) + y}{b}}\\ \mathbf{elif}\;x \le -485115.40011078131:\\ \;\;\;\;z - \frac{y}{\frac{\left(x + t\right) + y}{b}}\\ \mathbf{elif}\;x \le -6.6876587271108054 \cdot 10^{-170}:\\ \;\;\;\;a - y \cdot \frac{b}{\left(x + t\right) + y}\\ \mathbf{elif}\;x \le -2.860753366813772 \cdot 10^{-271}:\\ \;\;\;\;\frac{1}{\left(x + t\right) + y} \cdot \left(\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b\right)\\ \mathbf{elif}\;x \le 6.7642958276510964 \cdot 10^{-203}:\\ \;\;\;\;a - y \cdot \frac{b}{\left(x + t\right) + y}\\ \mathbf{elif}\;x \le 9.7109844173215245 \cdot 10^{230}:\\ \;\;\;\;\frac{\left(x + y\right) \cdot z + \left(t + y\right) \cdot a}{\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 2020060 
(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)))