Average Error: 26.2 → 21.3
Time: 7.2s
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 -5.154331974388478 \cdot 10^{+155}:\\ \;\;\;\;a - \frac{y}{x + \left(t + y\right)} \cdot b\\ \mathbf{elif}\;t \leq -1.4522351045742406 \cdot 10^{+51}:\\ \;\;\;\;\frac{\left(y + x\right) \cdot z + a \cdot \left(t + y\right)}{x + \left(t + y\right)} - \frac{y}{x + \left(t + y\right)} \cdot b\\ \mathbf{elif}\;t \leq 2.4212981744305287 \cdot 10^{-236}:\\ \;\;\;\;z - \frac{y}{\frac{x + \left(t + y\right)}{b}}\\ \mathbf{elif}\;t \leq 5.663926007528674 \cdot 10^{+142}:\\ \;\;\;\;\frac{\left(y + x\right) \cdot z + a \cdot \left(t + y\right)}{x + \left(t + y\right)} - \frac{y}{x + \left(t + y\right)} \cdot b\\ \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 -5.154331974388478 \cdot 10^{+155}:\\
\;\;\;\;a - \frac{y}{x + \left(t + y\right)} \cdot b\\

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

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

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

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

\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 (<= t -5.154331974388478e+155)
   (- a (* (/ y (+ x (+ t y))) b))
   (if (<= t -1.4522351045742406e+51)
     (-
      (/ (+ (* (+ y x) z) (* a (+ t y))) (+ x (+ t y)))
      (* (/ y (+ x (+ t y))) b))
     (if (<= t 2.4212981744305287e-236)
       (- z (/ y (/ (+ x (+ t y)) b)))
       (if (<= t 5.663926007528674e+142)
         (-
          (/ (+ (* (+ y x) z) (* a (+ t y))) (+ x (+ t y)))
          (* (/ y (+ x (+ t y))) b))
         (- a (* (/ y (+ x (+ t y))) 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 ((t <= -5.154331974388478e+155)) {
		tmp = ((double) (a - ((double) ((y / ((double) (x + ((double) (t + y))))) * b))));
	} else {
		double tmp_1;
		if ((t <= -1.4522351045742406e+51)) {
			tmp_1 = ((double) ((((double) (((double) (((double) (y + x)) * z)) + ((double) (a * ((double) (t + y)))))) / ((double) (x + ((double) (t + y))))) - ((double) ((y / ((double) (x + ((double) (t + y))))) * b))));
		} else {
			double tmp_2;
			if ((t <= 2.4212981744305287e-236)) {
				tmp_2 = ((double) (z - (y / (((double) (x + ((double) (t + y)))) / b))));
			} else {
				double tmp_3;
				if ((t <= 5.663926007528674e+142)) {
					tmp_3 = ((double) ((((double) (((double) (((double) (y + x)) * z)) + ((double) (a * ((double) (t + y)))))) / ((double) (x + ((double) (t + y))))) - ((double) ((y / ((double) (x + ((double) (t + y))))) * b))));
				} else {
					tmp_3 = ((double) (a - ((double) ((y / ((double) (x + ((double) (t + y))))) * b))));
				}
				tmp_2 = tmp_3;
			}
			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.2
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 t < -5.1543319743884775e155 or 5.6639260075286743e142 < t

    1. Initial program 34.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-sub_binary6434.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. Simplified34.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. Simplified34.8

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

      \[\leadsto \frac{\left(x + y\right) \cdot z + \left(y + t\right) \cdot a}{x + \left(y + t\right)} - \color{blue}{\frac{y}{\frac{x + \left(y + t\right)}{b}}}\]
    8. Using strategy rm
    9. Applied associate-/r/_binary6431.9

      \[\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}\]
    10. Taylor expanded around 0 20.2

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

    if -5.1543319743884775e155 < t < -1.45223510457424062e51 or 2.42129817443052866e-236 < t < 5.6639260075286743e142

    1. Initial program 24.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-sub_binary6424.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. Simplified24.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. Simplified24.2

      \[\leadsto \frac{\left(x + y\right) \cdot z + \left(y + t\right) \cdot a}{x + \left(y + t\right)} - \color{blue}{\frac{y \cdot b}{x + \left(y + t\right)}}\]
    6. Using strategy rm
    7. Applied associate-/l*_binary6422.1

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

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

    if -1.45223510457424062e51 < t < 2.42129817443052866e-236

    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-sub_binary6422.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. Simplified22.1

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -5.154331974388478 \cdot 10^{+155}:\\ \;\;\;\;a - \frac{y}{x + \left(t + y\right)} \cdot b\\ \mathbf{elif}\;t \leq -1.4522351045742406 \cdot 10^{+51}:\\ \;\;\;\;\frac{\left(y + x\right) \cdot z + a \cdot \left(t + y\right)}{x + \left(t + y\right)} - \frac{y}{x + \left(t + y\right)} \cdot b\\ \mathbf{elif}\;t \leq 2.4212981744305287 \cdot 10^{-236}:\\ \;\;\;\;z - \frac{y}{\frac{x + \left(t + y\right)}{b}}\\ \mathbf{elif}\;t \leq 5.663926007528674 \cdot 10^{+142}:\\ \;\;\;\;\frac{\left(y + x\right) \cdot z + a \cdot \left(t + y\right)}{x + \left(t + y\right)} - \frac{y}{x + \left(t + y\right)} \cdot b\\ \mathbf{else}:\\ \;\;\;\;a - \frac{y}{x + \left(t + y\right)} \cdot b\\ \end{array}\]

Reproduce

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