Average Error: 26.8 → 22.4
Time: 7.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}\;t \leq -7.946975425078722 \cdot 10^{+93}:\\ \;\;\;\;a - \frac{y}{x + \left(t + y\right)} \cdot b\\ \mathbf{elif}\;t \leq 1.5153690653489133 \cdot 10^{-230}:\\ \;\;\;\;z - \frac{y}{x + \left(t + y\right)} \cdot b\\ \mathbf{elif}\;t \leq 4.391480808848887 \cdot 10^{-196}:\\ \;\;\;\;\frac{z \cdot \left(y + x\right) + a \cdot \left(t + y\right)}{x + \left(t + y\right)} - y \cdot \frac{b}{x + \left(t + y\right)}\\ \mathbf{elif}\;t \leq 6.228761208579606 \cdot 10^{-66}:\\ \;\;\;\;z - \frac{y}{x + \left(t + y\right)} \cdot b\\ \mathbf{elif}\;t \leq 1.406756431860135 \cdot 10^{-27}:\\ \;\;\;\;\frac{z \cdot \left(y + x\right) + a \cdot \left(t + y\right)}{x + \left(t + y\right)} - y \cdot \frac{b}{x + \left(t + y\right)}\\ \mathbf{elif}\;t \leq 3.553301541827467 \cdot 10^{+47}:\\ \;\;\;\;z - \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 -7.946975425078722 \cdot 10^{+93}:\\
\;\;\;\;a - \frac{y}{x + \left(t + y\right)} \cdot b\\

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

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

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

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

\mathbf{elif}\;t \leq 3.553301541827467 \cdot 10^{+47}:\\
\;\;\;\;z - \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 -7.946975425078722e+93)
   (- a (* (/ y (+ x (+ t y))) b))
   (if (<= t 1.5153690653489133e-230)
     (- z (* (/ y (+ x (+ t y))) b))
     (if (<= t 4.391480808848887e-196)
       (-
        (/ (+ (* z (+ y x)) (* a (+ t y))) (+ x (+ t y)))
        (* y (/ b (+ x (+ t y)))))
       (if (<= t 6.228761208579606e-66)
         (- z (* (/ y (+ x (+ t y))) b))
         (if (<= t 1.406756431860135e-27)
           (-
            (/ (+ (* z (+ y x)) (* a (+ t y))) (+ x (+ t y)))
            (* y (/ b (+ x (+ t y)))))
           (if (<= t 3.553301541827467e+47)
             (- z (* (/ 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 VAR;
	if ((t <= -7.946975425078722e+93)) {
		VAR = ((double) (a - ((double) ((y / ((double) (x + ((double) (t + y))))) * b))));
	} else {
		double VAR_1;
		if ((t <= 1.5153690653489133e-230)) {
			VAR_1 = ((double) (z - ((double) ((y / ((double) (x + ((double) (t + y))))) * b))));
		} else {
			double VAR_2;
			if ((t <= 4.391480808848887e-196)) {
				VAR_2 = ((double) ((((double) (((double) (z * ((double) (y + x)))) + ((double) (a * ((double) (t + y)))))) / ((double) (x + ((double) (t + y))))) - ((double) (y * (b / ((double) (x + ((double) (t + y)))))))));
			} else {
				double VAR_3;
				if ((t <= 6.228761208579606e-66)) {
					VAR_3 = ((double) (z - ((double) ((y / ((double) (x + ((double) (t + y))))) * b))));
				} else {
					double VAR_4;
					if ((t <= 1.406756431860135e-27)) {
						VAR_4 = ((double) ((((double) (((double) (z * ((double) (y + x)))) + ((double) (a * ((double) (t + y)))))) / ((double) (x + ((double) (t + y))))) - ((double) (y * (b / ((double) (x + ((double) (t + y)))))))));
					} else {
						double VAR_5;
						if ((t <= 3.553301541827467e+47)) {
							VAR_5 = ((double) (z - ((double) ((y / ((double) (x + ((double) (t + y))))) * b))));
						} else {
							VAR_5 = ((double) (a - ((double) ((y / ((double) (x + ((double) (t + y))))) * b))));
						}
						VAR_4 = VAR_5;
					}
					VAR_3 = VAR_4;
				}
				VAR_2 = VAR_3;
			}
			VAR_1 = VAR_2;
		}
		VAR = VAR_1;
	}
	return VAR;
}

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
Target10.9
Herbie22.4
\[\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 < -7.9469754250787222e93 or 3.5533015418274671e47 < t

    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-sub33.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. Simplified30.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}\]
    6. Taylor expanded around 0 22.9

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

    if -7.9469754250787222e93 < t < 1.5153690653489133e-230 or 4.391480808848887e-196 < t < 6.2287612085796059e-66 or 1.4067564318601349e-27 < t < 3.5533015418274671e47

    1. Initial program 23.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. Using strategy rm
    3. Applied div-sub23.0

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

      \[\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. Simplified19.5

      \[\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}\]
    6. Taylor expanded around inf 22.5

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

    if 1.5153690653489133e-230 < t < 4.391480808848887e-196 or 6.2287612085796059e-66 < t < 1.4067564318601349e-27

    1. Initial program 20.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 div-sub20.3

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

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

      \[\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}\]
    6. Using strategy rm
    7. Applied div-inv17.7

      \[\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{1}{x + \left(y + t\right)}\right)} \cdot b\]
    8. Applied associate-*l*19.3

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -7.946975425078722 \cdot 10^{+93}:\\ \;\;\;\;a - \frac{y}{x + \left(t + y\right)} \cdot b\\ \mathbf{elif}\;t \leq 1.5153690653489133 \cdot 10^{-230}:\\ \;\;\;\;z - \frac{y}{x + \left(t + y\right)} \cdot b\\ \mathbf{elif}\;t \leq 4.391480808848887 \cdot 10^{-196}:\\ \;\;\;\;\frac{z \cdot \left(y + x\right) + a \cdot \left(t + y\right)}{x + \left(t + y\right)} - y \cdot \frac{b}{x + \left(t + y\right)}\\ \mathbf{elif}\;t \leq 6.228761208579606 \cdot 10^{-66}:\\ \;\;\;\;z - \frac{y}{x + \left(t + y\right)} \cdot b\\ \mathbf{elif}\;t \leq 1.406756431860135 \cdot 10^{-27}:\\ \;\;\;\;\frac{z \cdot \left(y + x\right) + a \cdot \left(t + y\right)}{x + \left(t + y\right)} - y \cdot \frac{b}{x + \left(t + y\right)}\\ \mathbf{elif}\;t \leq 3.553301541827467 \cdot 10^{+47}:\\ \;\;\;\;z - \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 2020198 
(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)))