Average Error: 26.4 → 23.9
Time: 22.0s
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 -7.7808166352996976 \cdot 10^{255}:\\ \;\;\;\;a - y \cdot \frac{b}{x + \left(t + y\right)}\\ \mathbf{elif}\;t \le -3.6223691579229488 \cdot 10^{-18}:\\ \;\;\;\;\frac{\left(y + x\right) \cdot z + a \cdot \left(t + y\right)}{x + \left(t + y\right)} - y \cdot \frac{b}{x + \left(t + y\right)}\\ \mathbf{elif}\;t \le -5.9615790635768166 \cdot 10^{-145}:\\ \;\;\;\;z - y \cdot \frac{b}{x + \left(t + y\right)}\\ \mathbf{elif}\;t \le -5.07035083730066068 \cdot 10^{-209}:\\ \;\;\;\;\frac{1}{\left(x + \left(t + y\right)\right) \cdot \frac{1}{\left(y + x\right) \cdot z + \left(t \cdot a + y \cdot \left(a - b\right)\right)}}\\ \mathbf{elif}\;t \le 6.89175063681203564 \cdot 10^{-209}:\\ \;\;\;\;z - y \cdot \frac{b}{x + \left(t + y\right)}\\ \mathbf{elif}\;t \le 1.2786425217679159 \cdot 10^{-78}:\\ \;\;\;\;\frac{\left(y + x\right) \cdot z + a \cdot \left(t + y\right)}{x + \left(t + y\right)} - y \cdot \frac{b}{x + \left(t + y\right)}\\ \mathbf{elif}\;t \le 4304730111250584.5:\\ \;\;\;\;z - y \cdot \frac{b}{x + \left(t + y\right)}\\ \mathbf{else}:\\ \;\;\;\;a - y \cdot \frac{b}{x + \left(t + y\right)}\\ \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 -7.7808166352996976 \cdot 10^{255}:\\
\;\;\;\;a - y \cdot \frac{b}{x + \left(t + y\right)}\\

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

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

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

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

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

\mathbf{elif}\;t \le 4304730111250584.5:\\
\;\;\;\;z - y \cdot \frac{b}{x + \left(t + y\right)}\\

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

\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 <= -7.780816635299698e+255)) {
		VAR = ((double) (a - ((double) (y * ((double) (b / ((double) (x + ((double) (t + y))))))))));
	} else {
		double VAR_1;
		if ((t <= -3.622369157922949e-18)) {
			VAR_1 = ((double) (((double) (((double) (((double) (((double) (y + x)) * z)) + ((double) (a * ((double) (t + y)))))) / ((double) (x + ((double) (t + y)))))) - ((double) (y * ((double) (b / ((double) (x + ((double) (t + y))))))))));
		} else {
			double VAR_2;
			if ((t <= -5.9615790635768166e-145)) {
				VAR_2 = ((double) (z - ((double) (y * ((double) (b / ((double) (x + ((double) (t + y))))))))));
			} else {
				double VAR_3;
				if ((t <= -5.070350837300661e-209)) {
					VAR_3 = ((double) (1.0 / ((double) (((double) (x + ((double) (t + y)))) * ((double) (1.0 / ((double) (((double) (((double) (y + x)) * z)) + ((double) (((double) (t * a)) + ((double) (y * ((double) (a - b))))))))))))));
				} else {
					double VAR_4;
					if ((t <= 6.891750636812036e-209)) {
						VAR_4 = ((double) (z - ((double) (y * ((double) (b / ((double) (x + ((double) (t + y))))))))));
					} else {
						double VAR_5;
						if ((t <= 1.2786425217679159e-78)) {
							VAR_5 = ((double) (((double) (((double) (((double) (((double) (y + x)) * z)) + ((double) (a * ((double) (t + y)))))) / ((double) (x + ((double) (t + y)))))) - ((double) (y * ((double) (b / ((double) (x + ((double) (t + y))))))))));
						} else {
							double VAR_6;
							if ((t <= 4304730111250584.5)) {
								VAR_6 = ((double) (z - ((double) (y * ((double) (b / ((double) (x + ((double) (t + y))))))))));
							} else {
								VAR_6 = ((double) (a - ((double) (y * ((double) (b / ((double) (x + ((double) (t + y))))))))));
							}
							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.4
Target11.8
Herbie23.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 4 regimes
  2. if t < -7.7808166352996976e255 or 4304730111250584.5 < t

    1. Initial program 32.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 div-sub32.4

      \[\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. Simplified32.4

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

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

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

    if -7.7808166352996976e255 < t < -3.6223691579229488e-18 or 6.89175063681203564e-209 < t < 1.2786425217679159e-78

    1. Initial program 26.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 div-sub26.4

      \[\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. Simplified26.4

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

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

    if -3.6223691579229488e-18 < t < -5.9615790635768166e-145 or -5.07035083730066068e-209 < t < 6.89175063681203564e-209 or 1.2786425217679159e-78 < t < 4304730111250584.5

    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-sub22.0

      \[\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. Simplified22.0

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

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

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

    if -5.9615790635768166e-145 < t < -5.07035083730066068e-209

    1. Initial program 22.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 clear-num22.6

      \[\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. Simplified22.6

      \[\leadsto \frac{1}{\color{blue}{\frac{x + \left(y + t\right)}{\left(x + y\right) \cdot z + \left(t \cdot a + y \cdot \left(a - b\right)\right)}}}\]
    5. Using strategy rm
    6. Applied div-inv22.8

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \le -7.7808166352996976 \cdot 10^{255}:\\ \;\;\;\;a - y \cdot \frac{b}{x + \left(t + y\right)}\\ \mathbf{elif}\;t \le -3.6223691579229488 \cdot 10^{-18}:\\ \;\;\;\;\frac{\left(y + x\right) \cdot z + a \cdot \left(t + y\right)}{x + \left(t + y\right)} - y \cdot \frac{b}{x + \left(t + y\right)}\\ \mathbf{elif}\;t \le -5.9615790635768166 \cdot 10^{-145}:\\ \;\;\;\;z - y \cdot \frac{b}{x + \left(t + y\right)}\\ \mathbf{elif}\;t \le -5.07035083730066068 \cdot 10^{-209}:\\ \;\;\;\;\frac{1}{\left(x + \left(t + y\right)\right) \cdot \frac{1}{\left(y + x\right) \cdot z + \left(t \cdot a + y \cdot \left(a - b\right)\right)}}\\ \mathbf{elif}\;t \le 6.89175063681203564 \cdot 10^{-209}:\\ \;\;\;\;z - y \cdot \frac{b}{x + \left(t + y\right)}\\ \mathbf{elif}\;t \le 1.2786425217679159 \cdot 10^{-78}:\\ \;\;\;\;\frac{\left(y + x\right) \cdot z + a \cdot \left(t + y\right)}{x + \left(t + y\right)} - y \cdot \frac{b}{x + \left(t + y\right)}\\ \mathbf{elif}\;t \le 4304730111250584.5:\\ \;\;\;\;z - y \cdot \frac{b}{x + \left(t + y\right)}\\ \mathbf{else}:\\ \;\;\;\;a - y \cdot \frac{b}{x + \left(t + y\right)}\\ \end{array}\]

Reproduce

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