Average Error: 27.0 → 20.9
Time: 6.1s
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 -5.404135654519083 \cdot 10^{+266}:\\ \;\;\;\;z - y \cdot \frac{b}{x + \left(y + t\right)}\\ \mathbf{elif}\;y \leq -1.4762398414904788 \cdot 10^{-41}:\\ \;\;\;\;a - y \cdot \frac{b}{x + \left(y + t\right)}\\ \mathbf{elif}\;y \leq 5.151723195463842 \cdot 10^{+116}:\\ \;\;\;\;\frac{z \cdot \left(y + x\right) + \left(y + t\right) \cdot a}{x + \left(y + t\right)} - \left(y \cdot \left(\sqrt[3]{b} \cdot \sqrt[3]{b}\right)\right) \cdot \frac{\sqrt[3]{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}\;y \leq -5.404135654519083 \cdot 10^{+266}:\\
\;\;\;\;z - y \cdot \frac{b}{x + \left(y + t\right)}\\

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

\mathbf{elif}\;y \leq 5.151723195463842 \cdot 10^{+116}:\\
\;\;\;\;\frac{z \cdot \left(y + x\right) + \left(y + t\right) \cdot a}{x + \left(y + t\right)} - \left(y \cdot \left(\sqrt[3]{b} \cdot \sqrt[3]{b}\right)\right) \cdot \frac{\sqrt[3]{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 (<= y -5.404135654519083e+266)
   (- z (* y (/ b (+ x (+ y t)))))
   (if (<= y -1.4762398414904788e-41)
     (- a (* y (/ b (+ x (+ y t)))))
     (if (<= y 5.151723195463842e+116)
       (-
        (/ (+ (* z (+ y x)) (* (+ y t) a)) (+ x (+ y t)))
        (* (* y (* (cbrt b) (cbrt b))) (/ (cbrt 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 (y <= -5.404135654519083e+266) {
		tmp = z - (y * (b / (x + (y + t))));
	} else if (y <= -1.4762398414904788e-41) {
		tmp = a - (y * (b / (x + (y + t))));
	} else if (y <= 5.151723195463842e+116) {
		tmp = (((z * (y + x)) + ((y + t) * a)) / (x + (y + t))) - ((y * (cbrt(b) * cbrt(b))) * (cbrt(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

Original27.0
Target11.6
Herbie20.9
\[\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 < -5.4041356545190832e266 or 5.15172319546384202e116 < y

    1. Initial program 48.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_binary6448.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. Simplified48.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. Simplified48.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 *-un-lft-identity_binary6448.1

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

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

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

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

    if -5.4041356545190832e266 < y < -1.47623984149047883e-41

    1. Initial program 33.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_binary6433.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. Simplified33.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. Simplified33.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_binary6433.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_binary6428.0

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

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

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

    if -1.47623984149047883e-41 < y < 5.15172319546384202e116

    1. Initial program 16.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_binary6416.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. Simplified16.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. Simplified16.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_binary6416.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_binary6418.0

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

      \[\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. Using strategy rm
    11. Applied *-un-lft-identity_binary6418.0

      \[\leadsto \frac{\left(x + y\right) \cdot z + \left(y + t\right) \cdot a}{x + \left(y + t\right)} - y \cdot \frac{b}{\color{blue}{1 \cdot \left(x + \left(y + t\right)\right)}}\]
    12. Applied add-cube-cbrt_binary6418.2

      \[\leadsto \frac{\left(x + y\right) \cdot z + \left(y + t\right) \cdot a}{x + \left(y + t\right)} - y \cdot \frac{\color{blue}{\left(\sqrt[3]{b} \cdot \sqrt[3]{b}\right) \cdot \sqrt[3]{b}}}{1 \cdot \left(x + \left(y + t\right)\right)}\]
    13. Applied times-frac_binary6418.2

      \[\leadsto \frac{\left(x + y\right) \cdot z + \left(y + t\right) \cdot a}{x + \left(y + t\right)} - y \cdot \color{blue}{\left(\frac{\sqrt[3]{b} \cdot \sqrt[3]{b}}{1} \cdot \frac{\sqrt[3]{b}}{x + \left(y + t\right)}\right)}\]
    14. Applied associate-*r*_binary6416.2

      \[\leadsto \frac{\left(x + y\right) \cdot z + \left(y + t\right) \cdot a}{x + \left(y + t\right)} - \color{blue}{\left(y \cdot \frac{\sqrt[3]{b} \cdot \sqrt[3]{b}}{1}\right) \cdot \frac{\sqrt[3]{b}}{x + \left(y + t\right)}}\]
    15. Simplified16.2

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -5.404135654519083 \cdot 10^{+266}:\\ \;\;\;\;z - y \cdot \frac{b}{x + \left(y + t\right)}\\ \mathbf{elif}\;y \leq -1.4762398414904788 \cdot 10^{-41}:\\ \;\;\;\;a - y \cdot \frac{b}{x + \left(y + t\right)}\\ \mathbf{elif}\;y \leq 5.151723195463842 \cdot 10^{+116}:\\ \;\;\;\;\frac{z \cdot \left(y + x\right) + \left(y + t\right) \cdot a}{x + \left(y + t\right)} - \left(y \cdot \left(\sqrt[3]{b} \cdot \sqrt[3]{b}\right)\right) \cdot \frac{\sqrt[3]{b}}{x + \left(y + t\right)}\\ \mathbf{else}:\\ \;\;\;\;z - y \cdot \frac{b}{x + \left(y + t\right)}\\ \end{array}\]

Reproduce

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