Average Error: 26.0 → 21.5
Time: 10.2s
Precision: binary64
\[\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.4808403197864043 \cdot 10^{173}:\\ \;\;\;\;a\\ \mathbf{elif}\;a \le -6.20353380324662266 \cdot 10^{128}:\\ \;\;\;\;\left(\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b\right) \cdot \frac{1}{\left(x + t\right) + y}\\ \mathbf{elif}\;a \le -1.1766897053029331 \cdot 10^{116}:\\ \;\;\;\;a\\ \mathbf{elif}\;a \le -2.32193569235281339 \cdot 10^{63}:\\ \;\;\;\;z\\ \mathbf{elif}\;a \le 9.6687036456074604 \cdot 10^{76}:\\ \;\;\;\;\frac{\left(x + y\right) \cdot z + \left(t + y\right) \cdot a}{\left(x + t\right) + y} - \frac{b}{\frac{\left(x + t\right) + y}{y}}\\ \mathbf{elif}\;a \le 4.09974571538634191 \cdot 10^{136}:\\ \;\;\;\;z\\ \mathbf{elif}\;a \le 7.8485985484343031 \cdot 10^{210}:\\ \;\;\;\;\frac{\left(x + y\right) \cdot z + \left(t + y\right) \cdot a}{\left(x + t\right) + y} - \frac{b}{\frac{\left(x + t\right) + y}{y}}\\ \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.4808403197864043 \cdot 10^{173}:\\
\;\;\;\;a\\

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

\mathbf{elif}\;a \le -1.1766897053029331 \cdot 10^{116}:\\
\;\;\;\;a\\

\mathbf{elif}\;a \le -2.32193569235281339 \cdot 10^{63}:\\
\;\;\;\;z\\

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

\mathbf{elif}\;a \le 4.09974571538634191 \cdot 10^{136}:\\
\;\;\;\;z\\

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

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

\end{array}
double code(double x, double y, double z, double t, double a, double b) {
	return ((double) (((double) (((double) (((double) (((double) (x + y)) * z)) + ((double) (((double) (t + y)) * a)))) - ((double) (y * b)))) / ((double) (((double) (x + t)) + y))));
}
double code(double x, double y, double z, double t, double a, double b) {
	double VAR;
	if ((a <= -1.4808403197864043e+173)) {
		VAR = a;
	} else {
		double VAR_1;
		if ((a <= -6.203533803246623e+128)) {
			VAR_1 = ((double) (((double) (((double) (((double) (((double) (x + y)) * z)) + ((double) (((double) (t + y)) * a)))) - ((double) (y * b)))) * ((double) (1.0 / ((double) (((double) (x + t)) + y))))));
		} else {
			double VAR_2;
			if ((a <= -1.176689705302933e+116)) {
				VAR_2 = a;
			} else {
				double VAR_3;
				if ((a <= -2.3219356923528134e+63)) {
					VAR_3 = z;
				} else {
					double VAR_4;
					if ((a <= 9.66870364560746e+76)) {
						VAR_4 = ((double) (((double) (((double) (((double) (((double) (x + y)) * z)) + ((double) (((double) (t + y)) * a)))) / ((double) (((double) (x + t)) + y)))) - ((double) (b / ((double) (((double) (((double) (x + t)) + y)) / y))))));
					} else {
						double VAR_5;
						if ((a <= 4.099745715386342e+136)) {
							VAR_5 = z;
						} else {
							double VAR_6;
							if ((a <= 7.848598548434303e+210)) {
								VAR_6 = ((double) (((double) (((double) (((double) (((double) (x + y)) * z)) + ((double) (((double) (t + y)) * a)))) / ((double) (((double) (x + t)) + y)))) - ((double) (b / ((double) (((double) (((double) (x + t)) + y)) / y))))));
							} else {
								VAR_6 = a;
							}
							VAR_5 = VAR_6;
						}
						VAR_4 = VAR_5;
					}
					VAR_3 = VAR_4;
				}
				VAR_2 = VAR_3;
			}
			VAR_1 = VAR_2;
		}
		VAR = VAR_1;
	}
	return VAR;
}

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.0
Target10.8
Herbie21.5
\[\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 a < -1.4808403197864043e173 or -6.20353380324662266e128 < a < -1.1766897053029331e116 or 7.8485985484343031e210 < a

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

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

    if -1.4808403197864043e173 < a < -6.20353380324662266e128

    1. Initial program 32.5

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

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

    if -1.1766897053029331e116 < a < -2.32193569235281339e63 or 9.6687036456074604e76 < a < 4.09974571538634191e136

    1. Initial program 31.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. Taylor expanded around inf 45.9

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

    if -2.32193569235281339e63 < a < 9.6687036456074604e76 or 4.09974571538634191e136 < a < 7.8485985484343031e210

    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 add-cube-cbrt20.5

      \[\leadsto \frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{\color{blue}{\left(\sqrt[3]{\left(x + t\right) + y} \cdot \sqrt[3]{\left(x + t\right) + y}\right) \cdot \sqrt[3]{\left(x + t\right) + y}}}\]
    4. Applied associate-/r*20.5

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

      \[\leadsto \frac{\color{blue}{\frac{\left(x + y\right) \cdot z + \left(t + y\right) \cdot a}{\sqrt[3]{\left(x + t\right) + y} \cdot \sqrt[3]{\left(x + t\right) + y}} - \frac{y \cdot b}{\sqrt[3]{\left(x + t\right) + y} \cdot \sqrt[3]{\left(x + t\right) + y}}}}{\sqrt[3]{\left(x + t\right) + y}}\]
    7. Applied div-sub20.5

      \[\leadsto \color{blue}{\frac{\frac{\left(x + y\right) \cdot z + \left(t + y\right) \cdot a}{\sqrt[3]{\left(x + t\right) + y} \cdot \sqrt[3]{\left(x + t\right) + y}}}{\sqrt[3]{\left(x + t\right) + y}} - \frac{\frac{y \cdot b}{\sqrt[3]{\left(x + t\right) + y} \cdot \sqrt[3]{\left(x + t\right) + y}}}{\sqrt[3]{\left(x + t\right) + y}}}\]
    8. Simplified19.9

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \le -1.4808403197864043 \cdot 10^{173}:\\ \;\;\;\;a\\ \mathbf{elif}\;a \le -6.20353380324662266 \cdot 10^{128}:\\ \;\;\;\;\left(\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b\right) \cdot \frac{1}{\left(x + t\right) + y}\\ \mathbf{elif}\;a \le -1.1766897053029331 \cdot 10^{116}:\\ \;\;\;\;a\\ \mathbf{elif}\;a \le -2.32193569235281339 \cdot 10^{63}:\\ \;\;\;\;z\\ \mathbf{elif}\;a \le 9.6687036456074604 \cdot 10^{76}:\\ \;\;\;\;\frac{\left(x + y\right) \cdot z + \left(t + y\right) \cdot a}{\left(x + t\right) + y} - \frac{b}{\frac{\left(x + t\right) + y}{y}}\\ \mathbf{elif}\;a \le 4.09974571538634191 \cdot 10^{136}:\\ \;\;\;\;z\\ \mathbf{elif}\;a \le 7.8485985484343031 \cdot 10^{210}:\\ \;\;\;\;\frac{\left(x + y\right) \cdot z + \left(t + y\right) \cdot a}{\left(x + t\right) + y} - \frac{b}{\frac{\left(x + t\right) + y}{y}}\\ \mathbf{else}:\\ \;\;\;\;a\\ \end{array}\]

Reproduce

herbie shell --seed 2020148 
(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.0 (/ (+ (+ 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)))