Average Error: 26.8 → 23.8
Time: 5.6s
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}\;z \leq -3.097554101876184 \cdot 10^{+166}:\\ \;\;\;\;z\\ \mathbf{elif}\;z \leq -5.0588825569742354 \cdot 10^{-238}:\\ \;\;\;\;\frac{1}{\frac{x + \left(y + t\right)}{\left(z \cdot \left(x + y\right) + \left(y + t\right) \cdot a\right) - y \cdot b}}\\ \mathbf{elif}\;z \leq -7.5621059774623085 \cdot 10^{-264}:\\ \;\;\;\;a\\ \mathbf{elif}\;z \leq 8.670749435847924 \cdot 10^{+98}:\\ \;\;\;\;\frac{1}{\frac{x + \left(y + t\right)}{\left(z \cdot \left(x + y\right) + \left(y + t\right) \cdot a\right) - y \cdot b}}\\ \mathbf{else}:\\ \;\;\;\;z\\ \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 \leq -3.097554101876184 \cdot 10^{+166}:\\
\;\;\;\;z\\

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

\mathbf{elif}\;z \leq -7.5621059774623085 \cdot 10^{-264}:\\
\;\;\;\;a\\

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

\mathbf{else}:\\
\;\;\;\;z\\

\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 (<= z -3.097554101876184e+166)
   z
   (if (<= z -5.0588825569742354e-238)
     (/ 1.0 (/ (+ x (+ y t)) (- (+ (* z (+ x y)) (* (+ y t) a)) (* y b))))
     (if (<= z -7.5621059774623085e-264)
       a
       (if (<= z 8.670749435847924e+98)
         (/ 1.0 (/ (+ x (+ y t)) (- (+ (* z (+ x y)) (* (+ y t) a)) (* y b))))
         z)))))
double code(double x, double y, double z, double t, double a, double b) {
	return ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y);
}
double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if (z <= -3.097554101876184e+166) {
		tmp = z;
	} else if (z <= -5.0588825569742354e-238) {
		tmp = 1.0 / ((x + (y + t)) / (((z * (x + y)) + ((y + t) * a)) - (y * b)));
	} else if (z <= -7.5621059774623085e-264) {
		tmp = a;
	} else if (z <= 8.670749435847924e+98) {
		tmp = 1.0 / ((x + (y + t)) / (((z * (x + y)) + ((y + t) * a)) - (y * b)));
	} else {
		tmp = z;
	}
	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.8
Target11.2
Herbie23.8
\[\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 z < -3.09755410187618414e166 or 8.6707494358479242e98 < z

    1. Initial program 41.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. Taylor expanded around inf 28.7

      \[\leadsto \color{blue}{z}\]

    if -3.09755410187618414e166 < z < -5.0588825569742354e-238 or -7.56210597746230853e-264 < z < 8.6707494358479242e98

    1. Initial program 21.3

      \[\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-num_binary6421.4

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

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

    if -5.0588825569742354e-238 < z < -7.56210597746230853e-264

    1. Initial program 19.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. Taylor expanded around 0 36.2

      \[\leadsto \color{blue}{a}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification23.8

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -3.097554101876184 \cdot 10^{+166}:\\ \;\;\;\;z\\ \mathbf{elif}\;z \leq -5.0588825569742354 \cdot 10^{-238}:\\ \;\;\;\;\frac{1}{\frac{x + \left(y + t\right)}{\left(z \cdot \left(x + y\right) + \left(y + t\right) \cdot a\right) - y \cdot b}}\\ \mathbf{elif}\;z \leq -7.5621059774623085 \cdot 10^{-264}:\\ \;\;\;\;a\\ \mathbf{elif}\;z \leq 8.670749435847924 \cdot 10^{+98}:\\ \;\;\;\;\frac{1}{\frac{x + \left(y + t\right)}{\left(z \cdot \left(x + y\right) + \left(y + t\right) \cdot a\right) - y \cdot b}}\\ \mathbf{else}:\\ \;\;\;\;z\\ \end{array}\]

Reproduce

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