Average Error: 26.6 → 21.3
Time: 6.8s
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 \leq -1.788086194814728 \cdot 10^{+257}:\\ \;\;\;\;z + b \cdot \frac{-1}{\frac{y + \left(x + t\right)}{y}}\\ \mathbf{elif}\;y \leq -1.0435287910912604 \cdot 10^{+224}:\\ \;\;\;\;a - b \cdot \frac{y}{x + \left(y + t\right)}\\ \mathbf{elif}\;y \leq -2.3432962437726123 \cdot 10^{+57} \lor \neg \left(y \leq 1.499046436222361 \cdot 10^{-23}\right):\\ \;\;\;\;z + b \cdot \frac{-1}{\frac{y + \left(x + t\right)}{y}}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{x + \left(y + t\right)}{z \cdot \left(y + x\right) + \left(t \cdot a + y \cdot \left(a - b\right)\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 \leq -1.788086194814728 \cdot 10^{+257}:\\
\;\;\;\;z + b \cdot \frac{-1}{\frac{y + \left(x + t\right)}{y}}\\

\mathbf{elif}\;y \leq -1.0435287910912604 \cdot 10^{+224}:\\
\;\;\;\;a - b \cdot \frac{y}{x + \left(y + t\right)}\\

\mathbf{elif}\;y \leq -2.3432962437726123 \cdot 10^{+57} \lor \neg \left(y \leq 1.499046436222361 \cdot 10^{-23}\right):\\
\;\;\;\;z + b \cdot \frac{-1}{\frac{y + \left(x + t\right)}{y}}\\

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

\end{array}
(FPCore (x y z t a b)
 :precision binary64
 (/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) (+ (+ x t) y)))
(FPCore (x y z t a b)
 :precision binary64
 (if (<= y -1.788086194814728e+257)
   (+ z (* b (/ -1.0 (/ (+ y (+ x t)) y))))
   (if (<= y -1.0435287910912604e+224)
     (- a (* b (/ y (+ x (+ y t)))))
     (if (or (<= y -2.3432962437726123e+57) (not (<= y 1.499046436222361e-23)))
       (+ z (* b (/ -1.0 (/ (+ y (+ x t)) y))))
       (/
        1.0
        (/ (+ x (+ y t)) (+ (* z (+ y x)) (+ (* t a) (* y (- a b))))))))))
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 tmp;
	if ((y <= -1.788086194814728e+257)) {
		tmp = ((double) (z + ((double) (b * (-1.0 / (((double) (y + ((double) (x + t)))) / y))))));
	} else {
		double tmp_1;
		if ((y <= -1.0435287910912604e+224)) {
			tmp_1 = ((double) (a - ((double) (b * (y / ((double) (x + ((double) (y + t)))))))));
		} else {
			double tmp_2;
			if (((y <= -2.3432962437726123e+57) || !(y <= 1.499046436222361e-23))) {
				tmp_2 = ((double) (z + ((double) (b * (-1.0 / (((double) (y + ((double) (x + t)))) / y))))));
			} else {
				tmp_2 = (1.0 / (((double) (x + ((double) (y + t)))) / ((double) (((double) (z * ((double) (y + x)))) + ((double) (((double) (t * a)) + ((double) (y * ((double) (a - b))))))))));
			}
			tmp_1 = tmp_2;
		}
		tmp = tmp_1;
	}
	return tmp;
}

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.6
Target11.5
Herbie21.3
\[\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 3 regimes
  2. if y < -1.78808619481472796e257 or -1.0435287910912604e224 < y < -2.3432962437726123e57 or 1.4990464362223609e-23 < y

    1. Initial program Error: 38.0 bits

      \[\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-subError: 38.0 bits

      \[\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. SimplifiedError: 38.0 bits

      \[\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. SimplifiedError: 31.8 bits

      \[\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 Error: 27.5 bits

      \[\leadsto \color{blue}{z} - \frac{y}{x + \left(y + t\right)} \cdot b\]
    7. Using strategy rm
    8. Applied clear-numError: 27.6 bits

      \[\leadsto z - \color{blue}{\frac{1}{\frac{x + \left(y + t\right)}{y}}} \cdot b\]
    9. SimplifiedError: 27.6 bits

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

    if -1.78808619481472796e257 < y < -1.0435287910912604e224

    1. Initial program Error: 49.6 bits

      \[\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-subError: 49.6 bits

      \[\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. SimplifiedError: 49.6 bits

      \[\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. SimplifiedError: 38.0 bits

      \[\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 Error: 22.2 bits

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

    if -2.3432962437726123e57 < y < 1.4990464362223609e-23

    1. Initial program Error: 15.8 bits

      \[\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-numError: 15.9 bits

      \[\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. SimplifiedError: 15.9 bits

      \[\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)}}}\]
  3. Recombined 3 regimes into one program.
  4. Final simplificationError: 21.3 bits

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.788086194814728 \cdot 10^{+257}:\\ \;\;\;\;z + b \cdot \frac{-1}{\frac{y + \left(x + t\right)}{y}}\\ \mathbf{elif}\;y \leq -1.0435287910912604 \cdot 10^{+224}:\\ \;\;\;\;a - b \cdot \frac{y}{x + \left(y + t\right)}\\ \mathbf{elif}\;y \leq -2.3432962437726123 \cdot 10^{+57} \lor \neg \left(y \leq 1.499046436222361 \cdot 10^{-23}\right):\\ \;\;\;\;z + b \cdot \frac{-1}{\frac{y + \left(x + t\right)}{y}}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{x + \left(y + t\right)}{z \cdot \left(y + x\right) + \left(t \cdot a + y \cdot \left(a - b\right)\right)}}\\ \end{array}\]

Reproduce

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