Average Error: 26.8 → 22.0
Time: 6.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 \leq -6.91578830349726 \cdot 10^{+35}:\\ \;\;\;\;a - \frac{y}{x + \left(t + y\right)} \cdot b\\ \mathbf{elif}\;t \leq -1.8141453022121192 \cdot 10^{-201}:\\ \;\;\;\;\frac{1}{\frac{x + \left(t + y\right)}{\left(y + x\right) \cdot z + \left(t \cdot a + y \cdot \left(a - b\right)\right)}}\\ \mathbf{elif}\;t \leq 1.4608526545304822 \cdot 10^{-170}:\\ \;\;\;\;z - \frac{y}{x + \left(t + y\right)} \cdot b\\ \mathbf{elif}\;t \leq 9.042614339967227 \cdot 10^{-130}:\\ \;\;\;\;\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 \leq 4.2757245011570004 \cdot 10^{-85}:\\ \;\;\;\;z - \frac{y}{x + \left(t + y\right)} \cdot b\\ \mathbf{elif}\;t \leq 1.7871583142091725 \cdot 10^{+19}:\\ \;\;\;\;\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{else}:\\ \;\;\;\;a - \frac{y}{x + \left(t + y\right)} \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}\;t \leq -6.91578830349726 \cdot 10^{+35}:\\
\;\;\;\;a - \frac{y}{x + \left(t + y\right)} \cdot b\\

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

\mathbf{elif}\;t \leq 1.4608526545304822 \cdot 10^{-170}:\\
\;\;\;\;z - \frac{y}{x + \left(t + y\right)} \cdot b\\

\mathbf{elif}\;t \leq 9.042614339967227 \cdot 10^{-130}:\\
\;\;\;\;\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 \leq 4.2757245011570004 \cdot 10^{-85}:\\
\;\;\;\;z - \frac{y}{x + \left(t + y\right)} \cdot b\\

\mathbf{elif}\;t \leq 1.7871583142091725 \cdot 10^{+19}:\\
\;\;\;\;\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{else}:\\
\;\;\;\;a - \frac{y}{x + \left(t + y\right)} \cdot b\\

\end{array}
double code(double x, double y, double z, double t, double a, double b) {
	return (((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 <= -6.91578830349726e+35)) {
		VAR = ((double) (a - ((double) ((y / ((double) (x + ((double) (t + y))))) * b))));
	} else {
		double VAR_1;
		if ((t <= -1.8141453022121192e-201)) {
			VAR_1 = (1.0 / (((double) (x + ((double) (t + y)))) / ((double) (((double) (((double) (y + x)) * z)) + ((double) (((double) (t * a)) + ((double) (y * ((double) (a - b))))))))));
		} else {
			double VAR_2;
			if ((t <= 1.4608526545304822e-170)) {
				VAR_2 = ((double) (z - ((double) ((y / ((double) (x + ((double) (t + y))))) * b))));
			} else {
				double VAR_3;
				if ((t <= 9.042614339967227e-130)) {
					VAR_3 = ((double) ((((double) (((double) (((double) (y + x)) * z)) + ((double) (a * ((double) (t + y)))))) / ((double) (x + ((double) (t + y))))) - ((double) (y * (b / ((double) (x + ((double) (t + y)))))))));
				} else {
					double VAR_4;
					if ((t <= 4.2757245011570004e-85)) {
						VAR_4 = ((double) (z - ((double) ((y / ((double) (x + ((double) (t + y))))) * b))));
					} else {
						double VAR_5;
						if ((t <= 1.7871583142091725e+19)) {
							VAR_5 = ((double) ((((double) (((double) (((double) (y + x)) * z)) + ((double) (a * ((double) (t + y)))))) / ((double) (x + ((double) (t + y))))) - ((double) (y * (b / ((double) (x + ((double) (t + y)))))))));
						} else {
							VAR_5 = ((double) (a - ((double) ((y / ((double) (x + ((double) (t + y))))) * b))));
						}
						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.8
Target11.0
Herbie22.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} < -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} < 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 < -6.91578830349725929e35 or 17871583142091724800 < t

    1. Initial program 31.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-sub31.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. Simplified31.8

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

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

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

    if -6.91578830349725929e35 < t < -1.81414530221211921e-201

    1. Initial program 21.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 clear-num21.8

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

      \[\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)}}}\]

    if -1.81414530221211921e-201 < t < 1.4608526545304822e-170 or 9.04261433996722738e-130 < t < 4.27572450115700041e-85

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

      \[\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.3

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

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

    if 1.4608526545304822e-170 < t < 9.04261433996722738e-130 or 4.27572450115700041e-85 < t < 17871583142091724800

    1. Initial program 22.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-sub22.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. Simplified22.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. Simplified18.7

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

      \[\leadsto \frac{\left(x + y\right) \cdot z + \left(y + t\right) \cdot a}{x + \left(y + t\right)} - \color{blue}{\left(y \cdot \frac{1}{x + \left(y + t\right)}\right)} \cdot b\]
    8. Applied associate-*l*19.7

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -6.91578830349726 \cdot 10^{+35}:\\ \;\;\;\;a - \frac{y}{x + \left(t + y\right)} \cdot b\\ \mathbf{elif}\;t \leq -1.8141453022121192 \cdot 10^{-201}:\\ \;\;\;\;\frac{1}{\frac{x + \left(t + y\right)}{\left(y + x\right) \cdot z + \left(t \cdot a + y \cdot \left(a - b\right)\right)}}\\ \mathbf{elif}\;t \leq 1.4608526545304822 \cdot 10^{-170}:\\ \;\;\;\;z - \frac{y}{x + \left(t + y\right)} \cdot b\\ \mathbf{elif}\;t \leq 9.042614339967227 \cdot 10^{-130}:\\ \;\;\;\;\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 \leq 4.2757245011570004 \cdot 10^{-85}:\\ \;\;\;\;z - \frac{y}{x + \left(t + y\right)} \cdot b\\ \mathbf{elif}\;t \leq 1.7871583142091725 \cdot 10^{+19}:\\ \;\;\;\;\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{else}:\\ \;\;\;\;a - \frac{y}{x + \left(t + y\right)} \cdot b\\ \end{array}\]

Reproduce

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