Average Error: 27.4 → 21.4
Time: 6.1s
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}\;z \le -1.0689119235642881 \cdot 10^{118}:\\ \;\;\;\;z - \frac{y}{\frac{\left(x + t\right) + y}{b}}\\ \mathbf{elif}\;z \le -1.55303636398772185 \cdot 10^{-194}:\\ \;\;\;\;\frac{\left(x + y\right) \cdot z + \left(t + y\right) \cdot a}{\left(x + t\right) + y} - \frac{\sqrt[3]{b} \cdot \sqrt[3]{b}}{\sqrt[3]{\left(x + t\right) + y} \cdot \sqrt[3]{\left(x + t\right) + y}} \cdot \frac{y}{\frac{\sqrt[3]{\left(x + t\right) + y}}{\sqrt[3]{b}}}\\ \mathbf{elif}\;z \le 3.4864848506241278 \cdot 10^{-193}:\\ \;\;\;\;a - \frac{y}{\left(x + t\right) + y} \cdot b\\ \mathbf{elif}\;z \le 7.144165907413302 \cdot 10^{-70}:\\ \;\;\;\;\frac{\left(x + y\right) \cdot z + \left(t + y\right) \cdot a}{\left(x + t\right) + y} - \frac{\sqrt[3]{b} \cdot \sqrt[3]{b}}{\sqrt[3]{\left(x + t\right) + y} \cdot \sqrt[3]{\left(x + t\right) + y}} \cdot \frac{y}{\frac{\sqrt[3]{\left(x + t\right) + y}}{\sqrt[3]{b}}}\\ \mathbf{elif}\;z \le 1.3585816266943533 \cdot 10^{45}:\\ \;\;\;\;a - \frac{y}{\left(x + t\right) + y} \cdot b\\ \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}\;z \le -1.0689119235642881 \cdot 10^{118}:\\
\;\;\;\;z - \frac{y}{\frac{\left(x + t\right) + y}{b}}\\

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

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

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

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

\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 ((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 ((z <= -1.068911923564288e+118)) {
		VAR = ((double) (z - ((double) (y / ((double) (((double) (((double) (x + t)) + y)) / b))))));
	} else {
		double VAR_1;
		if ((z <= -1.5530363639877218e-194)) {
			VAR_1 = ((double) (((double) (((double) (((double) (((double) (x + y)) * z)) + ((double) (((double) (t + y)) * a)))) / ((double) (((double) (x + t)) + y)))) - ((double) (((double) (((double) (((double) cbrt(b)) * ((double) cbrt(b)))) / ((double) (((double) cbrt(((double) (((double) (x + t)) + y)))) * ((double) cbrt(((double) (((double) (x + t)) + y)))))))) * ((double) (y / ((double) (((double) cbrt(((double) (((double) (x + t)) + y)))) / ((double) cbrt(b))))))))));
		} else {
			double VAR_2;
			if ((z <= 3.486484850624128e-193)) {
				VAR_2 = ((double) (a - ((double) (((double) (y / ((double) (((double) (x + t)) + y)))) * b))));
			} else {
				double VAR_3;
				if ((z <= 7.144165907413302e-70)) {
					VAR_3 = ((double) (((double) (((double) (((double) (((double) (x + y)) * z)) + ((double) (((double) (t + y)) * a)))) / ((double) (((double) (x + t)) + y)))) - ((double) (((double) (((double) (((double) cbrt(b)) * ((double) cbrt(b)))) / ((double) (((double) cbrt(((double) (((double) (x + t)) + y)))) * ((double) cbrt(((double) (((double) (x + t)) + y)))))))) * ((double) (y / ((double) (((double) cbrt(((double) (((double) (x + t)) + y)))) / ((double) cbrt(b))))))))));
				} else {
					double VAR_4;
					if ((z <= 1.3585816266943533e+45)) {
						VAR_4 = ((double) (a - ((double) (((double) (y / ((double) (((double) (x + t)) + y)))) * b))));
					} else {
						VAR_4 = ((double) (z - ((double) (y / ((double) (((double) (((double) (x + t)) + y)) / b))))));
					}
					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

Original27.4
Target11.5
Herbie21.4
\[\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 z < -1.068911923564288e+118 or 1.3585816266943533e+45 < z

    1. Initial program 38.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-sub38.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*38.6

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

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

    if -1.068911923564288e+118 < z < -1.5530363639877218e-194 or 3.486484850624128e-193 < z < 7.144165907413302e-70

    1. Initial program 21.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-sub21.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*17.5

      \[\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 add-cube-cbrt17.8

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

      \[\leadsto \frac{\left(x + y\right) \cdot z + \left(t + y\right) \cdot a}{\left(x + t\right) + y} - \frac{y}{\frac{\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}}}{\left(\sqrt[3]{b} \cdot \sqrt[3]{b}\right) \cdot \sqrt[3]{b}}}\]
    9. Applied times-frac17.8

      \[\leadsto \frac{\left(x + y\right) \cdot z + \left(t + y\right) \cdot a}{\left(x + t\right) + y} - \frac{y}{\color{blue}{\frac{\sqrt[3]{\left(x + t\right) + y} \cdot \sqrt[3]{\left(x + t\right) + y}}{\sqrt[3]{b} \cdot \sqrt[3]{b}} \cdot \frac{\sqrt[3]{\left(x + t\right) + y}}{\sqrt[3]{b}}}}\]
    10. Applied *-un-lft-identity17.8

      \[\leadsto \frac{\left(x + y\right) \cdot z + \left(t + y\right) \cdot a}{\left(x + t\right) + y} - \frac{\color{blue}{1 \cdot y}}{\frac{\sqrt[3]{\left(x + t\right) + y} \cdot \sqrt[3]{\left(x + t\right) + y}}{\sqrt[3]{b} \cdot \sqrt[3]{b}} \cdot \frac{\sqrt[3]{\left(x + t\right) + y}}{\sqrt[3]{b}}}\]
    11. Applied times-frac17.0

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

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

    if -1.5530363639877218e-194 < z < 3.486484850624128e-193 or 7.144165907413302e-70 < z < 1.3585816266943533e+45

    1. Initial program 20.2

      \[\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-sub20.2

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

      \[\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 associate-/r/15.9

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le -1.0689119235642881 \cdot 10^{118}:\\ \;\;\;\;z - \frac{y}{\frac{\left(x + t\right) + y}{b}}\\ \mathbf{elif}\;z \le -1.55303636398772185 \cdot 10^{-194}:\\ \;\;\;\;\frac{\left(x + y\right) \cdot z + \left(t + y\right) \cdot a}{\left(x + t\right) + y} - \frac{\sqrt[3]{b} \cdot \sqrt[3]{b}}{\sqrt[3]{\left(x + t\right) + y} \cdot \sqrt[3]{\left(x + t\right) + y}} \cdot \frac{y}{\frac{\sqrt[3]{\left(x + t\right) + y}}{\sqrt[3]{b}}}\\ \mathbf{elif}\;z \le 3.4864848506241278 \cdot 10^{-193}:\\ \;\;\;\;a - \frac{y}{\left(x + t\right) + y} \cdot b\\ \mathbf{elif}\;z \le 7.144165907413302 \cdot 10^{-70}:\\ \;\;\;\;\frac{\left(x + y\right) \cdot z + \left(t + y\right) \cdot a}{\left(x + t\right) + y} - \frac{\sqrt[3]{b} \cdot \sqrt[3]{b}}{\sqrt[3]{\left(x + t\right) + y} \cdot \sqrt[3]{\left(x + t\right) + y}} \cdot \frac{y}{\frac{\sqrt[3]{\left(x + t\right) + y}}{\sqrt[3]{b}}}\\ \mathbf{elif}\;z \le 1.3585816266943533 \cdot 10^{45}:\\ \;\;\;\;a - \frac{y}{\left(x + t\right) + y} \cdot b\\ \mathbf{else}:\\ \;\;\;\;z - \frac{y}{\frac{\left(x + t\right) + y}{b}}\\ \end{array}\]

Reproduce

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