Average Error: 26.8 → 20.9
Time: 5.8s
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}\;y \le -3.53457159304192573 \cdot 10^{123}:\\ \;\;\;\;a - y \cdot \frac{b}{\left(x + t\right) + y}\\ \mathbf{elif}\;y \le 5.17889059521794294 \cdot 10^{-14}:\\ \;\;\;\;\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}\;y \le 4537245.9502350241:\\ \;\;\;\;a - y \cdot \frac{b}{\left(x + t\right) + y}\\ \mathbf{elif}\;y \le 1.3148444083135898 \cdot 10^{70}:\\ \;\;\;\;\frac{\left(\left(x + y\right) \cdot z + \left(\left(t + y\right) \cdot \left(\sqrt[3]{a} \cdot \sqrt[3]{a}\right)\right) \cdot \sqrt[3]{a}\right) - y \cdot b}{\left(x + t\right) + y}\\ \mathbf{elif}\;y \le 2.3880130878574648 \cdot 10^{153}:\\ \;\;\;\;z - \left(\sqrt[3]{y \cdot \frac{b}{\left(x + t\right) + y}} \cdot \sqrt[3]{y \cdot \frac{b}{\left(x + t\right) + y}}\right) \cdot \sqrt[3]{y \cdot \frac{b}{\left(x + t\right) + y}}\\ \mathbf{elif}\;y \le 4.58538274402549 \cdot 10^{277}:\\ \;\;\;\;a - y \cdot \frac{b}{\left(x + t\right) + y}\\ \mathbf{else}:\\ \;\;\;\;z - \left(\sqrt[3]{y \cdot \frac{b}{\left(x + t\right) + y}} \cdot \sqrt[3]{y \cdot \frac{b}{\left(x + t\right) + y}}\right) \cdot \sqrt[3]{y \cdot \frac{b}{\left(x + t\right) + y}}\\ \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 -3.53457159304192573 \cdot 10^{123}:\\
\;\;\;\;a - y \cdot \frac{b}{\left(x + t\right) + y}\\

\mathbf{elif}\;y \le 5.17889059521794294 \cdot 10^{-14}:\\
\;\;\;\;\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}\;y \le 4537245.9502350241:\\
\;\;\;\;a - y \cdot \frac{b}{\left(x + t\right) + y}\\

\mathbf{elif}\;y \le 1.3148444083135898 \cdot 10^{70}:\\
\;\;\;\;\frac{\left(\left(x + y\right) \cdot z + \left(\left(t + y\right) \cdot \left(\sqrt[3]{a} \cdot \sqrt[3]{a}\right)\right) \cdot \sqrt[3]{a}\right) - y \cdot b}{\left(x + t\right) + y}\\

\mathbf{elif}\;y \le 2.3880130878574648 \cdot 10^{153}:\\
\;\;\;\;z - \left(\sqrt[3]{y \cdot \frac{b}{\left(x + t\right) + y}} \cdot \sqrt[3]{y \cdot \frac{b}{\left(x + t\right) + y}}\right) \cdot \sqrt[3]{y \cdot \frac{b}{\left(x + t\right) + y}}\\

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

\mathbf{else}:\\
\;\;\;\;z - \left(\sqrt[3]{y \cdot \frac{b}{\left(x + t\right) + y}} \cdot \sqrt[3]{y \cdot \frac{b}{\left(x + t\right) + y}}\right) \cdot \sqrt[3]{y \cdot \frac{b}{\left(x + t\right) + y}}\\

\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 ((y <= -3.534571593041926e+123)) {
		VAR = ((double) (a - ((double) (y * ((double) (b / ((double) (((double) (x + t)) + y))))))));
	} else {
		double VAR_1;
		if ((y <= 5.178890595217943e-14)) {
			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 ((y <= 4537245.950235024)) {
				VAR_2 = ((double) (a - ((double) (y * ((double) (b / ((double) (((double) (x + t)) + y))))))));
			} else {
				double VAR_3;
				if ((y <= 1.3148444083135898e+70)) {
					VAR_3 = ((double) (((double) (((double) (((double) (((double) (x + y)) * z)) + ((double) (((double) (((double) (t + y)) * ((double) (((double) cbrt(a)) * ((double) cbrt(a)))))) * ((double) cbrt(a)))))) - ((double) (y * b)))) / ((double) (((double) (x + t)) + y))));
				} else {
					double VAR_4;
					if ((y <= 2.3880130878574648e+153)) {
						VAR_4 = ((double) (z - ((double) (((double) (((double) cbrt(((double) (y * ((double) (b / ((double) (((double) (x + t)) + y)))))))) * ((double) cbrt(((double) (y * ((double) (b / ((double) (((double) (x + t)) + y)))))))))) * ((double) cbrt(((double) (y * ((double) (b / ((double) (((double) (x + t)) + y))))))))))));
					} else {
						double VAR_5;
						if ((y <= 4.58538274402549e+277)) {
							VAR_5 = ((double) (a - ((double) (y * ((double) (b / ((double) (((double) (x + t)) + y))))))));
						} else {
							VAR_5 = ((double) (z - ((double) (((double) (((double) cbrt(((double) (y * ((double) (b / ((double) (((double) (x + t)) + y)))))))) * ((double) cbrt(((double) (y * ((double) (b / ((double) (((double) (x + t)) + y)))))))))) * ((double) cbrt(((double) (y * ((double) (b / ((double) (((double) (x + t)) + y))))))))))));
						}
						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.8
Target11.7
Herbie20.9
\[\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 y < -3.53457159304192573e123 or 5.17889059521794294e-14 < y < 4537245.9502350241 or 2.3880130878574648e153 < y < 4.58538274402549e277

    1. Initial program 43.4

      \[\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-sub43.4

      \[\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-identity43.4

      \[\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-frac36.8

      \[\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. Simplified36.8

      \[\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 25.7

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

    if -3.53457159304192573e123 < y < 5.17889059521794294e-14

    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. Using strategy rm
    3. Applied div-inv17.1

      \[\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 4537245.9502350241 < y < 1.3148444083135898e70

    1. Initial program 23.3

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

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

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

    if 1.3148444083135898e70 < y < 2.3880130878574648e153 or 4.58538274402549e277 < y

    1. Initial program 41.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-sub41.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 *-un-lft-identity41.1

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

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

      \[\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. Using strategy rm
    9. Applied add-cube-cbrt33.9

      \[\leadsto \frac{\left(x + y\right) \cdot z + \left(t + y\right) \cdot a}{\left(x + t\right) + y} - \color{blue}{\left(\sqrt[3]{y \cdot \frac{b}{\left(x + t\right) + y}} \cdot \sqrt[3]{y \cdot \frac{b}{\left(x + t\right) + y}}\right) \cdot \sqrt[3]{y \cdot \frac{b}{\left(x + t\right) + y}}}\]
    10. Taylor expanded around inf 29.4

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \le -3.53457159304192573 \cdot 10^{123}:\\ \;\;\;\;a - y \cdot \frac{b}{\left(x + t\right) + y}\\ \mathbf{elif}\;y \le 5.17889059521794294 \cdot 10^{-14}:\\ \;\;\;\;\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}\;y \le 4537245.9502350241:\\ \;\;\;\;a - y \cdot \frac{b}{\left(x + t\right) + y}\\ \mathbf{elif}\;y \le 1.3148444083135898 \cdot 10^{70}:\\ \;\;\;\;\frac{\left(\left(x + y\right) \cdot z + \left(\left(t + y\right) \cdot \left(\sqrt[3]{a} \cdot \sqrt[3]{a}\right)\right) \cdot \sqrt[3]{a}\right) - y \cdot b}{\left(x + t\right) + y}\\ \mathbf{elif}\;y \le 2.3880130878574648 \cdot 10^{153}:\\ \;\;\;\;z - \left(\sqrt[3]{y \cdot \frac{b}{\left(x + t\right) + y}} \cdot \sqrt[3]{y \cdot \frac{b}{\left(x + t\right) + y}}\right) \cdot \sqrt[3]{y \cdot \frac{b}{\left(x + t\right) + y}}\\ \mathbf{elif}\;y \le 4.58538274402549 \cdot 10^{277}:\\ \;\;\;\;a - y \cdot \frac{b}{\left(x + t\right) + y}\\ \mathbf{else}:\\ \;\;\;\;z - \left(\sqrt[3]{y \cdot \frac{b}{\left(x + t\right) + y}} \cdot \sqrt[3]{y \cdot \frac{b}{\left(x + t\right) + y}}\right) \cdot \sqrt[3]{y \cdot \frac{b}{\left(x + t\right) + y}}\\ \end{array}\]

Reproduce

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