Average Error: 27.0 → 21.6
Time: 6.9s
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 -4.18392915342758798 \cdot 10^{128}:\\ \;\;\;\;z - \frac{y}{\frac{\left(x + t\right) + y}{b}}\\ \mathbf{elif}\;z \le -7.14790393964791004:\\ \;\;\;\;\frac{\left(x + y\right) \cdot z + \left(t + y\right) \cdot a}{\left(x + t\right) + y} - \frac{\frac{y}{\left(x + t\right) + y}}{\frac{1}{b}}\\ \mathbf{elif}\;z \le -3.286863353887011 \cdot 10^{-81}:\\ \;\;\;\;a - \frac{\frac{y}{\left(x + t\right) + y}}{\frac{1}{b}}\\ \mathbf{elif}\;z \le 3.3589536099189989 \cdot 10^{-64}:\\ \;\;\;\;\frac{\left(x + y\right) \cdot z + \left(t + y\right) \cdot a}{\left(x + t\right) + y} - \frac{\frac{y}{\left(x + t\right) + y}}{\frac{1}{b}}\\ \mathbf{elif}\;z \le 76588297349675.3594:\\ \;\;\;\;a - \frac{\frac{y}{\left(x + t\right) + y}}{\frac{1}{b}}\\ \mathbf{elif}\;z \le 9.26507213435906636 \cdot 10^{45}:\\ \;\;\;\;\frac{\left(x + y\right) \cdot z + \left(t + y\right) \cdot a}{\left(x + t\right) + y} - \frac{\frac{y}{\left(x + t\right) + y}}{\frac{1}{b}}\\ \mathbf{elif}\;z \le 1.38748197106132708 \cdot 10^{187}:\\ \;\;\;\;z - \frac{\frac{y}{\left(x + t\right) + y}}{\frac{1}{b}}\\ \mathbf{elif}\;z \le 5.78905677338978396 \cdot 10^{234}:\\ \;\;\;\;\frac{\left(x + y\right) \cdot z + \left(t + y\right) \cdot a}{\left(x + t\right) + y} - \frac{\frac{y}{\left(x + t\right) + y}}{\frac{1}{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 -4.18392915342758798 \cdot 10^{128}:\\
\;\;\;\;z - \frac{y}{\frac{\left(x + t\right) + y}{b}}\\

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

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

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

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

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

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

\mathbf{elif}\;z \le 5.78905677338978396 \cdot 10^{234}:\\
\;\;\;\;\frac{\left(x + y\right) \cdot z + \left(t + y\right) \cdot a}{\left(x + t\right) + y} - \frac{\frac{y}{\left(x + t\right) + y}}{\frac{1}{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 <= -4.183929153427588e+128)) {
		VAR = ((double) (z - ((double) (y / ((double) (((double) (((double) (x + t)) + y)) / b))))));
	} else {
		double VAR_1;
		if ((z <= -7.14790393964791)) {
			VAR_1 = ((double) (((double) (((double) (((double) (((double) (x + y)) * z)) + ((double) (((double) (t + y)) * a)))) / ((double) (((double) (x + t)) + y)))) - ((double) (((double) (y / ((double) (((double) (x + t)) + y)))) / ((double) (1.0 / b))))));
		} else {
			double VAR_2;
			if ((z <= -3.286863353887011e-81)) {
				VAR_2 = ((double) (a - ((double) (((double) (y / ((double) (((double) (x + t)) + y)))) / ((double) (1.0 / b))))));
			} else {
				double VAR_3;
				if ((z <= 3.358953609918999e-64)) {
					VAR_3 = ((double) (((double) (((double) (((double) (((double) (x + y)) * z)) + ((double) (((double) (t + y)) * a)))) / ((double) (((double) (x + t)) + y)))) - ((double) (((double) (y / ((double) (((double) (x + t)) + y)))) / ((double) (1.0 / b))))));
				} else {
					double VAR_4;
					if ((z <= 76588297349675.36)) {
						VAR_4 = ((double) (a - ((double) (((double) (y / ((double) (((double) (x + t)) + y)))) / ((double) (1.0 / b))))));
					} else {
						double VAR_5;
						if ((z <= 9.265072134359066e+45)) {
							VAR_5 = ((double) (((double) (((double) (((double) (((double) (x + y)) * z)) + ((double) (((double) (t + y)) * a)))) / ((double) (((double) (x + t)) + y)))) - ((double) (((double) (y / ((double) (((double) (x + t)) + y)))) / ((double) (1.0 / b))))));
						} else {
							double VAR_6;
							if ((z <= 1.387481971061327e+187)) {
								VAR_6 = ((double) (z - ((double) (((double) (y / ((double) (((double) (x + t)) + y)))) / ((double) (1.0 / b))))));
							} else {
								double VAR_7;
								if ((z <= 5.789056773389784e+234)) {
									VAR_7 = ((double) (((double) (((double) (((double) (((double) (x + y)) * z)) + ((double) (((double) (t + y)) * a)))) / ((double) (((double) (x + t)) + y)))) - ((double) (((double) (y / ((double) (((double) (x + t)) + y)))) / ((double) (1.0 / b))))));
								} else {
									VAR_7 = ((double) (z - ((double) (y / ((double) (((double) (((double) (x + t)) + y)) / b))))));
								}
								VAR_6 = VAR_7;
							}
							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

Original27.0
Target11.5
Herbie21.6
\[\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 z < -4.183929153427588e+128 or 5.789056773389784e+234 < z

    1. Initial program 42.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-sub42.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. Using strategy rm
    5. Applied associate-/l*43.1

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

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

    if -4.183929153427588e+128 < z < -7.14790393964791 or -3.286863353887011e-81 < z < 3.358953609918999e-64 or 76588297349675.36 < z < 9.265072134359066e+45 or 1.387481971061327e+187 < z < 5.789056773389784e+234

    1. Initial program 22.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-sub22.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*19.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 div-inv19.5

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

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

    if -7.14790393964791 < z < -3.286863353887011e-81 or 3.358953609918999e-64 < z < 76588297349675.36

    1. Initial program 19.6

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

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

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

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

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

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

    if 9.265072134359066e+45 < z < 1.387481971061327e+187

    1. Initial program 30.9

      \[\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-sub30.9

      \[\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*29.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 div-inv29.6

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le -4.18392915342758798 \cdot 10^{128}:\\ \;\;\;\;z - \frac{y}{\frac{\left(x + t\right) + y}{b}}\\ \mathbf{elif}\;z \le -7.14790393964791004:\\ \;\;\;\;\frac{\left(x + y\right) \cdot z + \left(t + y\right) \cdot a}{\left(x + t\right) + y} - \frac{\frac{y}{\left(x + t\right) + y}}{\frac{1}{b}}\\ \mathbf{elif}\;z \le -3.286863353887011 \cdot 10^{-81}:\\ \;\;\;\;a - \frac{\frac{y}{\left(x + t\right) + y}}{\frac{1}{b}}\\ \mathbf{elif}\;z \le 3.3589536099189989 \cdot 10^{-64}:\\ \;\;\;\;\frac{\left(x + y\right) \cdot z + \left(t + y\right) \cdot a}{\left(x + t\right) + y} - \frac{\frac{y}{\left(x + t\right) + y}}{\frac{1}{b}}\\ \mathbf{elif}\;z \le 76588297349675.3594:\\ \;\;\;\;a - \frac{\frac{y}{\left(x + t\right) + y}}{\frac{1}{b}}\\ \mathbf{elif}\;z \le 9.26507213435906636 \cdot 10^{45}:\\ \;\;\;\;\frac{\left(x + y\right) \cdot z + \left(t + y\right) \cdot a}{\left(x + t\right) + y} - \frac{\frac{y}{\left(x + t\right) + y}}{\frac{1}{b}}\\ \mathbf{elif}\;z \le 1.38748197106132708 \cdot 10^{187}:\\ \;\;\;\;z - \frac{\frac{y}{\left(x + t\right) + y}}{\frac{1}{b}}\\ \mathbf{elif}\;z \le 5.78905677338978396 \cdot 10^{234}:\\ \;\;\;\;\frac{\left(x + y\right) \cdot z + \left(t + y\right) \cdot a}{\left(x + t\right) + y} - \frac{\frac{y}{\left(x + t\right) + y}}{\frac{1}{b}}\\ \mathbf{else}:\\ \;\;\;\;z - \frac{y}{\frac{\left(x + t\right) + y}{b}}\\ \end{array}\]

Reproduce

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