Average Error: 26.8 → 20.8
Time: 6.0s
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 -5.718654454912934 \cdot 10^{+211}:\\ \;\;\;\;z - y \cdot \frac{b}{x + \left(y + t\right)}\\ \mathbf{elif}\;z \leq -1.253386679833485 \cdot 10^{+174}:\\ \;\;\;\;\frac{z \cdot \left(y + x\right) + \left(y + t\right) \cdot a}{x + \left(y + t\right)} - y \cdot \frac{b}{x + \left(y + t\right)}\\ \mathbf{elif}\;z \leq -1.4846978434193347 \cdot 10^{+133}:\\ \;\;\;\;z - y \cdot \frac{b}{x + \left(y + t\right)}\\ \mathbf{elif}\;z \leq -2.6301946553516078 \cdot 10^{+109}:\\ \;\;\;\;a - \frac{y}{\frac{x + \left(y + t\right)}{b}}\\ \mathbf{elif}\;z \leq -2.755837165222205 \cdot 10^{-86}:\\ \;\;\;\;\frac{z \cdot \left(y + x\right) + \left(y + t\right) \cdot a}{x + \left(y + t\right)} - y \cdot \frac{b}{x + \left(y + t\right)}\\ \mathbf{elif}\;z \leq -2.857698796196673 \cdot 10^{-162}:\\ \;\;\;\;a - \frac{y}{\frac{x + \left(y + t\right)}{b}}\\ \mathbf{elif}\;z \leq -1.2409296858903545 \cdot 10^{-196}:\\ \;\;\;\;\frac{z \cdot \left(y + x\right) + \left(y + t\right) \cdot a}{x + \left(y + t\right)} - y \cdot \frac{b}{x + \left(y + t\right)}\\ \mathbf{elif}\;z \leq -1.7458862711017074 \cdot 10^{-260}:\\ \;\;\;\;a - \frac{y}{\frac{x + \left(y + t\right)}{b}}\\ \mathbf{elif}\;z \leq -5.7955189878830535 \cdot 10^{-272}:\\ \;\;\;\;\left(\left(z \cdot \left(y + x\right) + \left(y + t\right) \cdot a\right) - y \cdot b\right) \cdot \frac{1}{x + \left(y + t\right)}\\ \mathbf{elif}\;z \leq 2.7687480808701386 \cdot 10^{+84}:\\ \;\;\;\;\frac{z \cdot \left(y + x\right) + \left(y + t\right) \cdot a}{x + \left(y + t\right)} - y \cdot \frac{b}{x + \left(y + t\right)}\\ \mathbf{else}:\\ \;\;\;\;z - y \cdot \frac{b}{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}\;z \leq -5.718654454912934 \cdot 10^{+211}:\\
\;\;\;\;z - y \cdot \frac{b}{x + \left(y + t\right)}\\

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

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

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

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

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

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

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

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

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

\mathbf{else}:\\
\;\;\;\;z - y \cdot \frac{b}{x + \left(y + t\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 (<= z -5.718654454912934e+211)
   (- z (* y (/ b (+ x (+ y t)))))
   (if (<= z -1.253386679833485e+174)
     (-
      (/ (+ (* z (+ y x)) (* (+ y t) a)) (+ x (+ y t)))
      (* y (/ b (+ x (+ y t)))))
     (if (<= z -1.4846978434193347e+133)
       (- z (* y (/ b (+ x (+ y t)))))
       (if (<= z -2.6301946553516078e+109)
         (- a (/ y (/ (+ x (+ y t)) b)))
         (if (<= z -2.755837165222205e-86)
           (-
            (/ (+ (* z (+ y x)) (* (+ y t) a)) (+ x (+ y t)))
            (* y (/ b (+ x (+ y t)))))
           (if (<= z -2.857698796196673e-162)
             (- a (/ y (/ (+ x (+ y t)) b)))
             (if (<= z -1.2409296858903545e-196)
               (-
                (/ (+ (* z (+ y x)) (* (+ y t) a)) (+ x (+ y t)))
                (* y (/ b (+ x (+ y t)))))
               (if (<= z -1.7458862711017074e-260)
                 (- a (/ y (/ (+ x (+ y t)) b)))
                 (if (<= z -5.7955189878830535e-272)
                   (*
                    (- (+ (* z (+ y x)) (* (+ y t) a)) (* y b))
                    (/ 1.0 (+ x (+ y t))))
                   (if (<= z 2.7687480808701386e+84)
                     (-
                      (/ (+ (* z (+ y x)) (* (+ y t) a)) (+ x (+ y t)))
                      (* y (/ b (+ x (+ y t)))))
                     (- z (* y (/ b (+ x (+ y t))))))))))))))))
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 <= -5.718654454912934e+211) {
		tmp = z - (y * (b / (x + (y + t))));
	} else if (z <= -1.253386679833485e+174) {
		tmp = (((z * (y + x)) + ((y + t) * a)) / (x + (y + t))) - (y * (b / (x + (y + t))));
	} else if (z <= -1.4846978434193347e+133) {
		tmp = z - (y * (b / (x + (y + t))));
	} else if (z <= -2.6301946553516078e+109) {
		tmp = a - (y / ((x + (y + t)) / b));
	} else if (z <= -2.755837165222205e-86) {
		tmp = (((z * (y + x)) + ((y + t) * a)) / (x + (y + t))) - (y * (b / (x + (y + t))));
	} else if (z <= -2.857698796196673e-162) {
		tmp = a - (y / ((x + (y + t)) / b));
	} else if (z <= -1.2409296858903545e-196) {
		tmp = (((z * (y + x)) + ((y + t) * a)) / (x + (y + t))) - (y * (b / (x + (y + t))));
	} else if (z <= -1.7458862711017074e-260) {
		tmp = a - (y / ((x + (y + t)) / b));
	} else if (z <= -5.7955189878830535e-272) {
		tmp = (((z * (y + x)) + ((y + t) * a)) - (y * b)) * (1.0 / (x + (y + t)));
	} else if (z <= 2.7687480808701386e+84) {
		tmp = (((z * (y + x)) + ((y + t) * a)) / (x + (y + t))) - (y * (b / (x + (y + t))));
	} else {
		tmp = z - (y * (b / (x + (y + t))));
	}
	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.3
Herbie20.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 4 regimes
  2. if z < -5.7186544549129338e211 or -1.25338667983348494e174 < z < -1.48469784341933467e133 or 2.76874808087013858e84 < z

    1. Initial program 41.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_binary6441.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. Simplified41.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. Simplified41.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 *-un-lft-identity_binary6441.2

      \[\leadsto \frac{\left(x + y\right) \cdot z + \left(y + t\right) \cdot a}{x + \left(y + t\right)} - \frac{y \cdot b}{\color{blue}{1 \cdot \left(x + \left(y + t\right)\right)}}\]
    8. Applied times-frac_binary6441.6

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

      \[\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)}\]
    10. Taylor expanded around inf 25.6

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

    if -5.7186544549129338e211 < z < -1.25338667983348494e174 or -2.6301946553516078e109 < z < -2.75583716522220502e-86 or -2.8576987961966729e-162 < z < -1.240929685890355e-196 or -5.7955189878830535e-272 < z < 2.76874808087013858e84

    1. Initial program 20.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-sub_binary6420.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. Simplified20.9

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

      \[\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 *-un-lft-identity_binary6420.9

      \[\leadsto \frac{\left(x + y\right) \cdot z + \left(y + t\right) \cdot a}{x + \left(y + t\right)} - \frac{y \cdot b}{\color{blue}{1 \cdot \left(x + \left(y + t\right)\right)}}\]
    8. Applied times-frac_binary6417.5

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

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

    if -1.48469784341933467e133 < z < -2.6301946553516078e109 or -2.75583716522220502e-86 < z < -2.8576987961966729e-162 or -1.240929685890355e-196 < z < -1.74588627110170737e-260

    1. Initial program 20.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_binary6420.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. Simplified20.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. Simplified20.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*_binary6417.4

      \[\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 0 24.2

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

    if -1.74588627110170737e-260 < z < -5.7955189878830535e-272

    1. Initial program 19.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-inv_binary6420.0

      \[\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. Simplified20.0

      \[\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 4 regimes into one program.
  4. Final simplification20.8

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -5.718654454912934 \cdot 10^{+211}:\\ \;\;\;\;z - y \cdot \frac{b}{x + \left(y + t\right)}\\ \mathbf{elif}\;z \leq -1.253386679833485 \cdot 10^{+174}:\\ \;\;\;\;\frac{z \cdot \left(y + x\right) + \left(y + t\right) \cdot a}{x + \left(y + t\right)} - y \cdot \frac{b}{x + \left(y + t\right)}\\ \mathbf{elif}\;z \leq -1.4846978434193347 \cdot 10^{+133}:\\ \;\;\;\;z - y \cdot \frac{b}{x + \left(y + t\right)}\\ \mathbf{elif}\;z \leq -2.6301946553516078 \cdot 10^{+109}:\\ \;\;\;\;a - \frac{y}{\frac{x + \left(y + t\right)}{b}}\\ \mathbf{elif}\;z \leq -2.755837165222205 \cdot 10^{-86}:\\ \;\;\;\;\frac{z \cdot \left(y + x\right) + \left(y + t\right) \cdot a}{x + \left(y + t\right)} - y \cdot \frac{b}{x + \left(y + t\right)}\\ \mathbf{elif}\;z \leq -2.857698796196673 \cdot 10^{-162}:\\ \;\;\;\;a - \frac{y}{\frac{x + \left(y + t\right)}{b}}\\ \mathbf{elif}\;z \leq -1.2409296858903545 \cdot 10^{-196}:\\ \;\;\;\;\frac{z \cdot \left(y + x\right) + \left(y + t\right) \cdot a}{x + \left(y + t\right)} - y \cdot \frac{b}{x + \left(y + t\right)}\\ \mathbf{elif}\;z \leq -1.7458862711017074 \cdot 10^{-260}:\\ \;\;\;\;a - \frac{y}{\frac{x + \left(y + t\right)}{b}}\\ \mathbf{elif}\;z \leq -5.7955189878830535 \cdot 10^{-272}:\\ \;\;\;\;\left(\left(z \cdot \left(y + x\right) + \left(y + t\right) \cdot a\right) - y \cdot b\right) \cdot \frac{1}{x + \left(y + t\right)}\\ \mathbf{elif}\;z \leq 2.7687480808701386 \cdot 10^{+84}:\\ \;\;\;\;\frac{z \cdot \left(y + x\right) + \left(y + t\right) \cdot a}{x + \left(y + t\right)} - y \cdot \frac{b}{x + \left(y + t\right)}\\ \mathbf{else}:\\ \;\;\;\;z - y \cdot \frac{b}{x + \left(y + t\right)}\\ \end{array}\]

Reproduce

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