Average Error: 27.0 → 21.0
Time: 9.8s
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 -9.59621725839655908 \cdot 10^{78}:\\ \;\;\;\;z - y \cdot \frac{b}{\left(x + t\right) + y}\\ \mathbf{elif}\;y \le 2.570722063616475 \cdot 10^{90}:\\ \;\;\;\;\frac{\frac{\mathsf{fma}\left(x + y, z, \left(t + y\right) \cdot a\right)}{\sqrt[3]{\left(x + t\right) + y} \cdot \sqrt[3]{\left(x + t\right) + y}}}{\sqrt[3]{\left(x + t\right) + y}} - \frac{y \cdot b}{\left(x + t\right) + y}\\ \mathbf{elif}\;y \le 2.0673661513817186 \cdot 10^{176}:\\ \;\;\;\;a - y \cdot \frac{b}{\left(x + t\right) + y}\\ \mathbf{else}:\\ \;\;\;\;z - 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 -9.59621725839655908 \cdot 10^{78}:\\
\;\;\;\;z - y \cdot \frac{b}{\left(x + t\right) + y}\\

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

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

\mathbf{else}:\\
\;\;\;\;z - 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 (((((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 temp;
	if ((y <= -9.596217258396559e+78)) {
		temp = (z - (y * (b / ((x + t) + y))));
	} else {
		double temp_1;
		if ((y <= 2.570722063616475e+90)) {
			temp_1 = (((fma((x + y), z, ((t + y) * a)) / (cbrt(((x + t) + y)) * cbrt(((x + t) + y)))) / cbrt(((x + t) + y))) - ((y * b) / ((x + t) + y)));
		} else {
			double temp_2;
			if ((y <= 2.0673661513817186e+176)) {
				temp_2 = (a - (y * (b / ((x + t) + y))));
			} else {
				temp_2 = (z - (y * (b / ((x + t) + y))));
			}
			temp_1 = temp_2;
		}
		temp = temp_1;
	}
	return temp;
}

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.0
Target11.1
Herbie21.0
\[\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 < -9.596217258396559e+78 or 2.0673661513817186e+176 < y

    1. Initial program 46.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-sub46.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. Simplified46.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 *-un-lft-identity46.2

      \[\leadsto \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}{\color{blue}{1 \cdot \left(\left(x + t\right) + y\right)}}\]
    7. Applied times-frac39.3

      \[\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}{1} \cdot \frac{b}{\left(x + t\right) + y}}\]
    8. Simplified39.3

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

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

    if -9.596217258396559e+78 < y < 2.570722063616475e+90

    1. Initial program 17.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-sub17.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. Simplified17.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 add-cube-cbrt17.8

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

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

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

    if 2.570722063616475e+90 < y < 2.0673661513817186e+176

    1. Initial program 35.8

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

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

      \[\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 *-un-lft-identity35.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 \cdot b}{\color{blue}{1 \cdot \left(\left(x + t\right) + y\right)}}\]
    7. Applied times-frac28.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}{1} \cdot \frac{b}{\left(x + t\right) + y}}\]
    8. Simplified28.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}{y} \cdot \frac{b}{\left(x + t\right) + y}\]
    9. Taylor expanded around 0 25.6

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \le -9.59621725839655908 \cdot 10^{78}:\\ \;\;\;\;z - y \cdot \frac{b}{\left(x + t\right) + y}\\ \mathbf{elif}\;y \le 2.570722063616475 \cdot 10^{90}:\\ \;\;\;\;\frac{\frac{\mathsf{fma}\left(x + y, z, \left(t + y\right) \cdot a\right)}{\sqrt[3]{\left(x + t\right) + y} \cdot \sqrt[3]{\left(x + t\right) + y}}}{\sqrt[3]{\left(x + t\right) + y}} - \frac{y \cdot b}{\left(x + t\right) + y}\\ \mathbf{elif}\;y \le 2.0673661513817186 \cdot 10^{176}:\\ \;\;\;\;a - y \cdot \frac{b}{\left(x + t\right) + y}\\ \mathbf{else}:\\ \;\;\;\;z - y \cdot \frac{b}{\left(x + t\right) + y}\\ \end{array}\]

Reproduce

herbie shell --seed 2020056 +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)))