Average Error: 26.5 → 16.7
Time: 7.3s
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}\;y \le -5.35235414659780861 \cdot 10^{48}:\\ \;\;\;\;\left(a + z\right) - b\\ \mathbf{elif}\;y \le -1.92517275137635566 \cdot 10^{-61}:\\ \;\;\;\;\frac{\left(x + y\right) \cdot z + \left(y \cdot \left(a - b\right) + a \cdot t\right)}{\left(x + t\right) + y}\\ \mathbf{elif}\;y \le -2.51501501672513634 \cdot 10^{-116}:\\ \;\;\;\;a\\ \mathbf{elif}\;y \le 5.45003729820436518 \cdot 10^{86}:\\ \;\;\;\;\frac{\left(x + y\right) \cdot z + \left(y \cdot \left(a - b\right) + a \cdot t\right)}{\left(x + t\right) + y}\\ \mathbf{else}:\\ \;\;\;\;\left(a + z\right) - 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}\;y \le -5.35235414659780861 \cdot 10^{48}:\\
\;\;\;\;\left(a + z\right) - b\\

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

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

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

\mathbf{else}:\\
\;\;\;\;\left(a + z\right) - b\\

\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 <= -5.3523541465978086e+48)) {
		VAR = ((double) (((double) (a + z)) - b));
	} else {
		double VAR_1;
		if ((y <= -1.9251727513763557e-61)) {
			VAR_1 = ((double) (((double) (((double) (((double) (x + y)) * z)) + ((double) (((double) (y * ((double) (a - b)))) + ((double) (a * t)))))) / ((double) (((double) (x + t)) + y))));
		} else {
			double VAR_2;
			if ((y <= -2.5150150167251363e-116)) {
				VAR_2 = a;
			} else {
				double VAR_3;
				if ((y <= 5.450037298204365e+86)) {
					VAR_3 = ((double) (((double) (((double) (((double) (x + y)) * z)) + ((double) (((double) (y * ((double) (a - b)))) + ((double) (a * t)))))) / ((double) (((double) (x + t)) + y))));
				} else {
					VAR_3 = ((double) (((double) (a + z)) - b));
				}
				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.5
Target11.3
Herbie16.7
\[\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 3 regimes
  2. if y < -5.3523541465978086e+48 or 5.450037298204365e+86 < y

    1. Initial program 43.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 clear-num43.1

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

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

    if -5.3523541465978086e+48 < y < -1.9251727513763557e-61 or -2.5150150167251363e-116 < y < 5.450037298204365e+86

    1. Initial program 15.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 add-cube-cbrt16.0

      \[\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*16.0

      \[\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}\]
    5. Using strategy rm
    6. Applied *-un-lft-identity16.0

      \[\leadsto \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}{\color{blue}{1 \cdot \left(\left(x + t\right) + y\right)}}\]
    7. Applied associate-/r*16.0

      \[\leadsto \color{blue}{\frac{\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}{1}}{\left(x + t\right) + y}}\]
    8. Simplified15.6

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

    if -1.9251727513763557e-61 < y < -2.5150150167251363e-116

    1. Initial program 14.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 44.2

      \[\leadsto \color{blue}{a}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification16.7

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \le -5.35235414659780861 \cdot 10^{48}:\\ \;\;\;\;\left(a + z\right) - b\\ \mathbf{elif}\;y \le -1.92517275137635566 \cdot 10^{-61}:\\ \;\;\;\;\frac{\left(x + y\right) \cdot z + \left(y \cdot \left(a - b\right) + a \cdot t\right)}{\left(x + t\right) + y}\\ \mathbf{elif}\;y \le -2.51501501672513634 \cdot 10^{-116}:\\ \;\;\;\;a\\ \mathbf{elif}\;y \le 5.45003729820436518 \cdot 10^{86}:\\ \;\;\;\;\frac{\left(x + y\right) \cdot z + \left(y \cdot \left(a - b\right) + a \cdot t\right)}{\left(x + t\right) + y}\\ \mathbf{else}:\\ \;\;\;\;\left(a + z\right) - b\\ \end{array}\]

Reproduce

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