Average Error: 26.2 → 25.9
Time: 8.5s
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}\;t \le -1.877425623621617 \cdot 10^{129}:\\ \;\;\;\;a\\ \mathbf{elif}\;t \le -4.29951474949930605 \cdot 10^{92}:\\ \;\;\;\;\frac{1}{\left(\left(x + t\right) + y\right) \cdot \frac{1}{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}}\\ \mathbf{elif}\;t \le -1.25926199172426231 \cdot 10^{-92}:\\ \;\;\;\;\left(a + z\right) - b\\ \mathbf{elif}\;t \le -1.20705898493034513 \cdot 10^{-269}:\\ \;\;\;\;\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}\;t \le 6.4644815128971739 \cdot 10^{-85}:\\ \;\;\;\;\left(a + z\right) - b\\ \mathbf{elif}\;t \le 1.372403736194714 \cdot 10^{55}:\\ \;\;\;\;\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}\;t \le 5.2849132795166073 \cdot 10^{81}:\\ \;\;\;\;z\\ \mathbf{elif}\;t \le 6.06352514701041726 \cdot 10^{110}:\\ \;\;\;\;\frac{1}{\left(\left(x + t\right) + y\right) \cdot \frac{1}{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}}\\ \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}\;t \le -1.877425623621617 \cdot 10^{129}:\\
\;\;\;\;a\\

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

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

\mathbf{elif}\;t \le -1.20705898493034513 \cdot 10^{-269}:\\
\;\;\;\;\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}\;t \le 6.4644815128971739 \cdot 10^{-85}:\\
\;\;\;\;\left(a + z\right) - b\\

\mathbf{elif}\;t \le 1.372403736194714 \cdot 10^{55}:\\
\;\;\;\;\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}\;t \le 5.2849132795166073 \cdot 10^{81}:\\
\;\;\;\;z\\

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

\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 ((t <= -1.877425623621617e+129)) {
		VAR = a;
	} else {
		double VAR_1;
		if ((t <= -4.299514749499306e+92)) {
			VAR_1 = ((double) (1.0 / ((double) (((double) (((double) (x + t)) + y)) * ((double) (1.0 / ((double) (((double) (((double) (((double) (x + y)) * z)) + ((double) (((double) (t + y)) * a)))) - ((double) (y * b))))))))));
		} else {
			double VAR_2;
			if ((t <= -1.2592619917242623e-92)) {
				VAR_2 = ((double) (((double) (a + z)) - b));
			} else {
				double VAR_3;
				if ((t <= -1.2070589849303451e-269)) {
					VAR_3 = ((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_4;
					if ((t <= 6.464481512897174e-85)) {
						VAR_4 = ((double) (((double) (a + z)) - b));
					} else {
						double VAR_5;
						if ((t <= 1.3724037361947135e+55)) {
							VAR_5 = ((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_6;
							if ((t <= 5.284913279516607e+81)) {
								VAR_6 = z;
							} else {
								double VAR_7;
								if ((t <= 6.063525147010417e+110)) {
									VAR_7 = ((double) (1.0 / ((double) (((double) (((double) (x + t)) + y)) * ((double) (1.0 / ((double) (((double) (((double) (((double) (x + y)) * z)) + ((double) (((double) (t + y)) * a)))) - ((double) (y * b))))))))));
								} else {
									VAR_7 = a;
								}
								VAR_6 = VAR_7;
							}
							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.2
Target10.9
Herbie25.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 5 regimes
  2. if t < -1.877425623621617e+129 or 6.063525147010417e+110 < t

    1. Initial program 35.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 30.1

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

    if -1.877425623621617e+129 < t < -4.299514749499306e+92 or 5.284913279516607e+81 < t < 6.063525147010417e+110

    1. Initial program 26.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 clear-num26.8

      \[\leadsto \color{blue}{\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}}}\]
    4. Using strategy rm
    5. Applied div-inv26.8

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

    if -4.299514749499306e+92 < t < -1.2592619917242623e-92 or -1.2070589849303451e-269 < t < 6.464481512897174e-85

    1. Initial program 21.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 clear-num21.5

      \[\leadsto \color{blue}{\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}}}\]
    4. Taylor expanded around 0 23.9

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

    if -1.2592619917242623e-92 < t < -1.2070589849303451e-269 or 6.464481512897174e-85 < t < 1.3724037361947135e+55

    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 div-inv22.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 1.3724037361947135e+55 < t < 5.284913279516607e+81

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

      \[\leadsto \color{blue}{z}\]
  3. Recombined 5 regimes into one program.
  4. Final simplification25.9

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \le -1.877425623621617 \cdot 10^{129}:\\ \;\;\;\;a\\ \mathbf{elif}\;t \le -4.29951474949930605 \cdot 10^{92}:\\ \;\;\;\;\frac{1}{\left(\left(x + t\right) + y\right) \cdot \frac{1}{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}}\\ \mathbf{elif}\;t \le -1.25926199172426231 \cdot 10^{-92}:\\ \;\;\;\;\left(a + z\right) - b\\ \mathbf{elif}\;t \le -1.20705898493034513 \cdot 10^{-269}:\\ \;\;\;\;\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}\;t \le 6.4644815128971739 \cdot 10^{-85}:\\ \;\;\;\;\left(a + z\right) - b\\ \mathbf{elif}\;t \le 1.372403736194714 \cdot 10^{55}:\\ \;\;\;\;\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}\;t \le 5.2849132795166073 \cdot 10^{81}:\\ \;\;\;\;z\\ \mathbf{elif}\;t \le 6.06352514701041726 \cdot 10^{110}:\\ \;\;\;\;\frac{1}{\left(\left(x + t\right) + y\right) \cdot \frac{1}{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}}\\ \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)))