Average Error: 26.9 → 10.5
Time: 15.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 -3.5923451958019774 \cdot 10^{+56}:\\ \;\;\;\;\left(z + a\right) - b\\ \mathbf{elif}\;y \leq -1.5383444662198045 \cdot 10^{-99}:\\ \;\;\;\;\left(\frac{y \cdot a}{x + \left(y + t\right)} + \left(\frac{x}{\frac{x + \left(y + t\right)}{z}} + \left(\frac{t}{\frac{x + \left(y + t\right)}{a}} + \frac{y \cdot z}{x + \left(y + t\right)}\right)\right)\right) - \frac{y \cdot b}{x + \left(y + t\right)}\\ \mathbf{elif}\;y \leq -5.98723732135947 \cdot 10^{-163}:\\ \;\;\;\;\frac{1}{\frac{x + \left(y + t\right)}{\left(z \cdot \left(y + x\right) + a \cdot \left(y + t\right)\right) - y \cdot b}}\\ \mathbf{elif}\;y \leq 5.0281505230896065 \cdot 10^{+98}:\\ \;\;\;\;\left(\frac{y \cdot a}{x + \left(y + t\right)} + \left(\left(\frac{t}{\frac{x + \left(y + t\right)}{a}} + \frac{y \cdot z}{x + \left(y + t\right)}\right) + \frac{x}{\sqrt[3]{x + \left(y + t\right)} \cdot \sqrt[3]{x + \left(y + t\right)}} \cdot \frac{z}{\sqrt[3]{x + \left(y + t\right)}}\right)\right) - \frac{y \cdot b}{x + \left(y + t\right)}\\ \mathbf{else}:\\ \;\;\;\;\left(z + a\right) - 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}\;y \leq -3.5923451958019774 \cdot 10^{+56}:\\
\;\;\;\;\left(z + a\right) - b\\

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

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

\mathbf{elif}\;y \leq 5.0281505230896065 \cdot 10^{+98}:\\
\;\;\;\;\left(\frac{y \cdot a}{x + \left(y + t\right)} + \left(\left(\frac{t}{\frac{x + \left(y + t\right)}{a}} + \frac{y \cdot z}{x + \left(y + t\right)}\right) + \frac{x}{\sqrt[3]{x + \left(y + t\right)} \cdot \sqrt[3]{x + \left(y + t\right)}} \cdot \frac{z}{\sqrt[3]{x + \left(y + t\right)}}\right)\right) - \frac{y \cdot b}{x + \left(y + t\right)}\\

\mathbf{else}:\\
\;\;\;\;\left(z + a\right) - 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 (<= y -3.5923451958019774e+56)
   (- (+ z a) b)
   (if (<= y -1.5383444662198045e-99)
     (-
      (+
       (/ (* y a) (+ x (+ y t)))
       (+
        (/ x (/ (+ x (+ y t)) z))
        (+ (/ t (/ (+ x (+ y t)) a)) (/ (* y z) (+ x (+ y t))))))
      (/ (* y b) (+ x (+ y t))))
     (if (<= y -5.98723732135947e-163)
       (/ 1.0 (/ (+ x (+ y t)) (- (+ (* z (+ y x)) (* a (+ y t))) (* y b))))
       (if (<= y 5.0281505230896065e+98)
         (-
          (+
           (/ (* y a) (+ x (+ y t)))
           (+
            (+ (/ t (/ (+ x (+ y t)) a)) (/ (* y z) (+ x (+ y t))))
            (*
             (/ x (* (cbrt (+ x (+ y t))) (cbrt (+ x (+ y t)))))
             (/ z (cbrt (+ x (+ y t)))))))
          (/ (* y b) (+ x (+ y t))))
         (- (+ z a) b))))))
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 (y <= -3.5923451958019774e+56) {
		tmp = (z + a) - b;
	} else if (y <= -1.5383444662198045e-99) {
		tmp = (((y * a) / (x + (y + t))) + ((x / ((x + (y + t)) / z)) + ((t / ((x + (y + t)) / a)) + ((y * z) / (x + (y + t)))))) - ((y * b) / (x + (y + t)));
	} else if (y <= -5.98723732135947e-163) {
		tmp = 1.0 / ((x + (y + t)) / (((z * (y + x)) + (a * (y + t))) - (y * b)));
	} else if (y <= 5.0281505230896065e+98) {
		tmp = (((y * a) / (x + (y + t))) + (((t / ((x + (y + t)) / a)) + ((y * z) / (x + (y + t)))) + ((x / (cbrt(x + (y + t)) * cbrt(x + (y + t)))) * (z / cbrt(x + (y + t)))))) - ((y * b) / (x + (y + t)));
	} else {
		tmp = (z + a) - b;
	}
	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.9
Target11.4
Herbie10.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} < -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 y < -3.59234519580197738e56 or 5.0281505230896065e98 < y

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

      \[\leadsto \color{blue}{\left(a + z\right) - b}\]
    3. Simplified14.0

      \[\leadsto \color{blue}{\left(z + a\right) - b}\]

    if -3.59234519580197738e56 < y < -1.53834446621980454e-99

    1. Initial program 18.6

      \[\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 18.6

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

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

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

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

    if -1.53834446621980454e-99 < y < -5.98723732135947004e-163

    1. Initial program 14.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 clear-num_binary64_2053714.9

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

      \[\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.98723732135947004e-163 < y < 5.0281505230896065e98

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

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

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

      \[\leadsto \left(\frac{y \cdot a}{x + \left(y + t\right)} + \left(\frac{x \cdot z}{x + \left(y + t\right)} + \left(\color{blue}{\frac{t}{\frac{x + \left(y + t\right)}{a}}} + \frac{y \cdot z}{x + \left(y + t\right)}\right)\right)\right) - \frac{y \cdot b}{x + \left(y + t\right)}\]
    6. Using strategy rm
    7. Applied add-cube-cbrt_binary64_2057314.6

      \[\leadsto \left(\frac{y \cdot a}{x + \left(y + t\right)} + \left(\frac{x \cdot z}{\color{blue}{\left(\sqrt[3]{x + \left(y + t\right)} \cdot \sqrt[3]{x + \left(y + t\right)}\right) \cdot \sqrt[3]{x + \left(y + t\right)}}} + \left(\frac{t}{\frac{x + \left(y + t\right)}{a}} + \frac{y \cdot z}{x + \left(y + t\right)}\right)\right)\right) - \frac{y \cdot b}{x + \left(y + t\right)}\]
    8. Applied times-frac_binary64_205447.9

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -3.5923451958019774 \cdot 10^{+56}:\\ \;\;\;\;\left(z + a\right) - b\\ \mathbf{elif}\;y \leq -1.5383444662198045 \cdot 10^{-99}:\\ \;\;\;\;\left(\frac{y \cdot a}{x + \left(y + t\right)} + \left(\frac{x}{\frac{x + \left(y + t\right)}{z}} + \left(\frac{t}{\frac{x + \left(y + t\right)}{a}} + \frac{y \cdot z}{x + \left(y + t\right)}\right)\right)\right) - \frac{y \cdot b}{x + \left(y + t\right)}\\ \mathbf{elif}\;y \leq -5.98723732135947 \cdot 10^{-163}:\\ \;\;\;\;\frac{1}{\frac{x + \left(y + t\right)}{\left(z \cdot \left(y + x\right) + a \cdot \left(y + t\right)\right) - y \cdot b}}\\ \mathbf{elif}\;y \leq 5.0281505230896065 \cdot 10^{+98}:\\ \;\;\;\;\left(\frac{y \cdot a}{x + \left(y + t\right)} + \left(\left(\frac{t}{\frac{x + \left(y + t\right)}{a}} + \frac{y \cdot z}{x + \left(y + t\right)}\right) + \frac{x}{\sqrt[3]{x + \left(y + t\right)} \cdot \sqrt[3]{x + \left(y + t\right)}} \cdot \frac{z}{\sqrt[3]{x + \left(y + t\right)}}\right)\right) - \frac{y \cdot b}{x + \left(y + t\right)}\\ \mathbf{else}:\\ \;\;\;\;\left(z + a\right) - b\\ \end{array}\]

Reproduce

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