Average Error: 26.3 → 21.5
Time: 18.4s
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}\;y \le -1.0677618729601775 \cdot 10^{258}:\\ \;\;\;\;a - y \cdot \frac{b}{x + \left(y + t\right)}\\ \mathbf{elif}\;y \le -6821795244285730230000 \lor \neg \left(y \le 4.32234753106425839 \cdot 10^{-38} \lor \neg \left(y \le 2.8904966271832427 \cdot 10^{109}\right) \land y \le 1.8982219138742053 \cdot 10^{145}\right):\\ \;\;\;\;z - y \cdot \frac{b}{x + \left(y + t\right)}\\ \mathbf{else}:\\ \;\;\;\;\left(\left(z \cdot \left(y + x\right) + a \cdot \left(y + t\right)\right) - y \cdot b\right) \cdot \frac{1}{x + \left(y + t\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}\;y \le -1.0677618729601775 \cdot 10^{258}:\\
\;\;\;\;a - y \cdot \frac{b}{x + \left(y + t\right)}\\

\mathbf{elif}\;y \le -6821795244285730230000 \lor \neg \left(y \le 4.32234753106425839 \cdot 10^{-38} \lor \neg \left(y \le 2.8904966271832427 \cdot 10^{109}\right) \land y \le 1.8982219138742053 \cdot 10^{145}\right):\\
\;\;\;\;z - y \cdot \frac{b}{x + \left(y + t\right)}\\

\mathbf{else}:\\
\;\;\;\;\left(\left(z \cdot \left(y + x\right) + a \cdot \left(y + t\right)\right) - y \cdot b\right) \cdot \frac{1}{x + \left(y + t\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 ((y <= -1.0677618729601775e+258)) {
		VAR = ((double) (a - ((double) (y * ((double) (b / ((double) (x + ((double) (y + t))))))))));
	} else {
		double VAR_1;
		if (((y <= -6.82179524428573e+21) || !((y <= 4.3223475310642584e-38) || (!(y <= 2.8904966271832427e+109) && (y <= 1.8982219138742053e+145))))) {
			VAR_1 = ((double) (z - ((double) (y * ((double) (b / ((double) (x + ((double) (y + t))))))))));
		} else {
			VAR_1 = ((double) (((double) (((double) (((double) (z * ((double) (y + x)))) + ((double) (a * ((double) (y + t)))))) - ((double) (y * b)))) * ((double) (1.0 / ((double) (x + ((double) (y + t))))))));
		}
		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.3
Target11.0
Herbie21.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 3 regimes
  2. if y < -1.0677618729601775e258

    1. Initial program 54.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-sub54.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. Simplified54.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. Simplified45.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)}}\]
    6. Taylor expanded around 0 22.1

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

    if -1.0677618729601775e258 < y < -6821795244285730230000 or 4.32234753106425839e-38 < y < 2.8904966271832427e109 or 1.8982219138742053e145 < y

    1. Initial program 35.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-sub35.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. Simplified35.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.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 27.6

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

    if -6821795244285730230000 < y < 4.32234753106425839e-38 or 2.8904966271832427e109 < y < 1.8982219138742053e145

    1. Initial program 16.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-inv16.1

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \le -1.0677618729601775 \cdot 10^{258}:\\ \;\;\;\;a - y \cdot \frac{b}{x + \left(y + t\right)}\\ \mathbf{elif}\;y \le -6821795244285730230000 \lor \neg \left(y \le 4.32234753106425839 \cdot 10^{-38} \lor \neg \left(y \le 2.8904966271832427 \cdot 10^{109}\right) \land y \le 1.8982219138742053 \cdot 10^{145}\right):\\ \;\;\;\;z - y \cdot \frac{b}{x + \left(y + t\right)}\\ \mathbf{else}:\\ \;\;\;\;\left(\left(z \cdot \left(y + x\right) + a \cdot \left(y + t\right)\right) - y \cdot b\right) \cdot \frac{1}{x + \left(y + t\right)}\\ \end{array}\]

Reproduce

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