Average Error: 26.4 → 19.5
Time: 6.2s
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}\;a \le -1.8094282358139013 \cdot 10^{93}:\\ \;\;\;\;a - \frac{y}{\left(x + t\right) + y} \cdot b\\ \mathbf{elif}\;a \le 1.8555915042103347 \cdot 10^{-100}:\\ \;\;\;\;\frac{\frac{\mathsf{fma}\left(x + y, z, \left(t + y\right) \cdot a\right)}{1}}{\left(x + t\right) + y} - \frac{\sqrt[3]{y} \cdot \sqrt[3]{y}}{\sqrt[3]{\left(x + t\right) + y} \cdot \sqrt[3]{\left(x + t\right) + y}} \cdot \left(\frac{\sqrt[3]{y}}{\sqrt[3]{\left(x + t\right) + y}} \cdot b\right)\\ \mathbf{elif}\;a \le 1.3909060355411578 \cdot 10^{-42}:\\ \;\;\;\;z - \frac{y}{\left(x + t\right) + y} \cdot b\\ \mathbf{elif}\;a \le 7.87267627449342466 \cdot 10^{48}:\\ \;\;\;\;\frac{\frac{\mathsf{fma}\left(x + y, z, \left(t + y\right) \cdot a\right)}{1}}{\left(x + t\right) + y} - \frac{\frac{y}{\sqrt[3]{\left(x + t\right) + y} \cdot \sqrt[3]{\left(x + t\right) + y}}}{\frac{\sqrt[3]{\left(x + t\right) + y}}{b}}\\ \mathbf{else}:\\ \;\;\;\;a - \frac{y}{\left(x + t\right) + y} \cdot 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}\;a \le -1.8094282358139013 \cdot 10^{93}:\\
\;\;\;\;a - \frac{y}{\left(x + t\right) + y} \cdot b\\

\mathbf{elif}\;a \le 1.8555915042103347 \cdot 10^{-100}:\\
\;\;\;\;\frac{\frac{\mathsf{fma}\left(x + y, z, \left(t + y\right) \cdot a\right)}{1}}{\left(x + t\right) + y} - \frac{\sqrt[3]{y} \cdot \sqrt[3]{y}}{\sqrt[3]{\left(x + t\right) + y} \cdot \sqrt[3]{\left(x + t\right) + y}} \cdot \left(\frac{\sqrt[3]{y}}{\sqrt[3]{\left(x + t\right) + y}} \cdot b\right)\\

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

\mathbf{elif}\;a \le 7.87267627449342466 \cdot 10^{48}:\\
\;\;\;\;\frac{\frac{\mathsf{fma}\left(x + y, z, \left(t + y\right) \cdot a\right)}{1}}{\left(x + t\right) + y} - \frac{\frac{y}{\sqrt[3]{\left(x + t\right) + y} \cdot \sqrt[3]{\left(x + t\right) + y}}}{\frac{\sqrt[3]{\left(x + t\right) + y}}{b}}\\

\mathbf{else}:\\
\;\;\;\;a - \frac{y}{\left(x + t\right) + y} \cdot b\\

\end{array}
double code(double x, double y, double z, double t, double a, double b) {
	return (((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y));
}
double code(double x, double y, double z, double t, double a, double b) {
	double VAR;
	if ((a <= -1.8094282358139013e+93)) {
		VAR = (a - ((y / ((x + t) + y)) * b));
	} else {
		double VAR_1;
		if ((a <= 1.8555915042103347e-100)) {
			VAR_1 = (((fma((x + y), z, ((t + y) * a)) / 1.0) / ((x + t) + y)) - (((cbrt(y) * cbrt(y)) / (cbrt(((x + t) + y)) * cbrt(((x + t) + y)))) * ((cbrt(y) / cbrt(((x + t) + y))) * b)));
		} else {
			double VAR_2;
			if ((a <= 1.3909060355411578e-42)) {
				VAR_2 = (z - ((y / ((x + t) + y)) * b));
			} else {
				double VAR_3;
				if ((a <= 7.872676274493425e+48)) {
					VAR_3 = (((fma((x + y), z, ((t + y) * a)) / 1.0) / ((x + t) + y)) - ((y / (cbrt(((x + t) + y)) * cbrt(((x + t) + y)))) / (cbrt(((x + t) + y)) / b)));
				} else {
					VAR_3 = (a - ((y / ((x + t) + y)) * 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.4
Target11.2
Herbie19.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.8094282358139013e+93 or 7.872676274493425e+48 < a

    1. Initial program 38.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-sub38.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. Simplified38.2

      \[\leadsto \color{blue}{\frac{\frac{\mathsf{fma}\left(x + y, z, \left(t + y\right) \cdot a\right)}{1}}{\left(x + t\right) + y}} - \frac{y \cdot b}{\left(x + t\right) + y}\]
    5. Using strategy rm
    6. Applied associate-/l*37.9

      \[\leadsto \frac{\frac{\mathsf{fma}\left(x + y, z, \left(t + y\right) \cdot a\right)}{1}}{\left(x + t\right) + y} - \color{blue}{\frac{y}{\frac{\left(x + t\right) + y}{b}}}\]
    7. Using strategy rm
    8. Applied associate-/r/37.2

      \[\leadsto \frac{\frac{\mathsf{fma}\left(x + y, z, \left(t + y\right) \cdot a\right)}{1}}{\left(x + t\right) + y} - \color{blue}{\frac{y}{\left(x + t\right) + y} \cdot b}\]
    9. Taylor expanded around 0 26.4

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

    if -1.8094282358139013e+93 < a < 1.8555915042103347e-100

    1. Initial program 18.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-sub18.5

      \[\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. Simplified18.5

      \[\leadsto \color{blue}{\frac{\frac{\mathsf{fma}\left(x + y, z, \left(t + y\right) \cdot a\right)}{1}}{\left(x + t\right) + y}} - \frac{y \cdot b}{\left(x + t\right) + y}\]
    5. Using strategy rm
    6. Applied associate-/l*15.7

      \[\leadsto \frac{\frac{\mathsf{fma}\left(x + y, z, \left(t + y\right) \cdot a\right)}{1}}{\left(x + t\right) + y} - \color{blue}{\frac{y}{\frac{\left(x + t\right) + y}{b}}}\]
    7. Using strategy rm
    8. Applied associate-/r/15.0

      \[\leadsto \frac{\frac{\mathsf{fma}\left(x + y, z, \left(t + y\right) \cdot a\right)}{1}}{\left(x + t\right) + y} - \color{blue}{\frac{y}{\left(x + t\right) + y} \cdot b}\]
    9. Using strategy rm
    10. Applied add-cube-cbrt15.3

      \[\leadsto \frac{\frac{\mathsf{fma}\left(x + y, z, \left(t + y\right) \cdot a\right)}{1}}{\left(x + t\right) + y} - \frac{y}{\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}}} \cdot b\]
    11. Applied add-cube-cbrt15.2

      \[\leadsto \frac{\frac{\mathsf{fma}\left(x + y, z, \left(t + y\right) \cdot a\right)}{1}}{\left(x + t\right) + y} - \frac{\color{blue}{\left(\sqrt[3]{y} \cdot \sqrt[3]{y}\right) \cdot \sqrt[3]{y}}}{\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}} \cdot b\]
    12. Applied times-frac15.2

      \[\leadsto \frac{\frac{\mathsf{fma}\left(x + y, z, \left(t + y\right) \cdot a\right)}{1}}{\left(x + t\right) + y} - \color{blue}{\left(\frac{\sqrt[3]{y} \cdot \sqrt[3]{y}}{\sqrt[3]{\left(x + t\right) + y} \cdot \sqrt[3]{\left(x + t\right) + y}} \cdot \frac{\sqrt[3]{y}}{\sqrt[3]{\left(x + t\right) + y}}\right)} \cdot b\]
    13. Applied associate-*l*14.4

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

    if 1.8555915042103347e-100 < a < 1.3909060355411578e-42

    1. Initial program 23.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-sub23.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. Simplified23.1

      \[\leadsto \color{blue}{\frac{\frac{\mathsf{fma}\left(x + y, z, \left(t + y\right) \cdot a\right)}{1}}{\left(x + t\right) + y}} - \frac{y \cdot b}{\left(x + t\right) + y}\]
    5. Using strategy rm
    6. Applied associate-/l*16.6

      \[\leadsto \frac{\frac{\mathsf{fma}\left(x + y, z, \left(t + y\right) \cdot a\right)}{1}}{\left(x + t\right) + y} - \color{blue}{\frac{y}{\frac{\left(x + t\right) + y}{b}}}\]
    7. Using strategy rm
    8. Applied associate-/r/16.5

      \[\leadsto \frac{\frac{\mathsf{fma}\left(x + y, z, \left(t + y\right) \cdot a\right)}{1}}{\left(x + t\right) + y} - \color{blue}{\frac{y}{\left(x + t\right) + y} \cdot b}\]
    9. Taylor expanded around inf 23.4

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

    if 1.3909060355411578e-42 < a < 7.872676274493425e+48

    1. Initial program 20.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-sub20.5

      \[\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. Simplified20.5

      \[\leadsto \color{blue}{\frac{\frac{\mathsf{fma}\left(x + y, z, \left(t + y\right) \cdot a\right)}{1}}{\left(x + t\right) + y}} - \frac{y \cdot b}{\left(x + t\right) + y}\]
    5. Using strategy rm
    6. Applied associate-/l*16.5

      \[\leadsto \frac{\frac{\mathsf{fma}\left(x + y, z, \left(t + y\right) \cdot a\right)}{1}}{\left(x + t\right) + y} - \color{blue}{\frac{y}{\frac{\left(x + t\right) + y}{b}}}\]
    7. Using strategy rm
    8. Applied *-un-lft-identity16.5

      \[\leadsto \frac{\frac{\mathsf{fma}\left(x + y, z, \left(t + y\right) \cdot a\right)}{1}}{\left(x + t\right) + y} - \frac{y}{\frac{\left(x + t\right) + y}{\color{blue}{1 \cdot b}}}\]
    9. Applied add-cube-cbrt16.8

      \[\leadsto \frac{\frac{\mathsf{fma}\left(x + y, z, \left(t + y\right) \cdot a\right)}{1}}{\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}}}{1 \cdot b}}\]
    10. Applied times-frac16.8

      \[\leadsto \frac{\frac{\mathsf{fma}\left(x + y, z, \left(t + y\right) \cdot a\right)}{1}}{\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}}{1} \cdot \frac{\sqrt[3]{\left(x + t\right) + y}}{b}}}\]
    11. Applied associate-/r*16.1

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \le -1.8094282358139013 \cdot 10^{93}:\\ \;\;\;\;a - \frac{y}{\left(x + t\right) + y} \cdot b\\ \mathbf{elif}\;a \le 1.8555915042103347 \cdot 10^{-100}:\\ \;\;\;\;\frac{\frac{\mathsf{fma}\left(x + y, z, \left(t + y\right) \cdot a\right)}{1}}{\left(x + t\right) + y} - \frac{\sqrt[3]{y} \cdot \sqrt[3]{y}}{\sqrt[3]{\left(x + t\right) + y} \cdot \sqrt[3]{\left(x + t\right) + y}} \cdot \left(\frac{\sqrt[3]{y}}{\sqrt[3]{\left(x + t\right) + y}} \cdot b\right)\\ \mathbf{elif}\;a \le 1.3909060355411578 \cdot 10^{-42}:\\ \;\;\;\;z - \frac{y}{\left(x + t\right) + y} \cdot b\\ \mathbf{elif}\;a \le 7.87267627449342466 \cdot 10^{48}:\\ \;\;\;\;\frac{\frac{\mathsf{fma}\left(x + y, z, \left(t + y\right) \cdot a\right)}{1}}{\left(x + t\right) + y} - \frac{\frac{y}{\sqrt[3]{\left(x + t\right) + y} \cdot \sqrt[3]{\left(x + t\right) + y}}}{\frac{\sqrt[3]{\left(x + t\right) + y}}{b}}\\ \mathbf{else}:\\ \;\;\;\;a - \frac{y}{\left(x + t\right) + y} \cdot b\\ \end{array}\]

Reproduce

herbie shell --seed 2020075 +o rules:numerics
(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 (/ (+ (+ 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)))