Average Error: 23.4 → 16.4
Time: 3.9m
Precision: 64
\[\frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)}\]
\[\begin{array}{l} \mathbf{if}\;\frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)} = -\infty:\\ \;\;\;\;\frac{t}{b} - \frac{a}{b}\\ \mathbf{elif}\;\frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)} \le -8.00947989807014 \cdot 10^{-223}:\\ \;\;\;\;\frac{\mathsf{fma}\left(x, y, z \cdot \left(t - a\right)\right) + z \cdot \mathsf{fma}\left(-\sqrt[3]{a}, \sqrt[3]{a} \cdot \sqrt[3]{a}, \sqrt[3]{a} \cdot \left(\sqrt[3]{a} \cdot \left(\sqrt[3]{\sqrt[3]{a} \cdot \sqrt[3]{a}} \cdot \sqrt[3]{\sqrt[3]{a}}\right)\right)\right)}{y + z \cdot \left(b - y\right)}\\ \mathbf{elif}\;\frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)} \le -0.0:\\ \;\;\;\;\frac{t}{b} - \frac{a}{b}\\ \mathbf{elif}\;\frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)} \le 1.37529062950492253 \cdot 10^{304}:\\ \;\;\;\;\frac{1}{\frac{\mathsf{fma}\left(z, b - y, y\right)}{\mathsf{fma}\left(x, y, z \cdot \left(t - a\right)\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{t}{b} - \frac{a}{b}\\ \end{array}\]
\frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)}
\begin{array}{l}
\mathbf{if}\;\frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)} = -\infty:\\
\;\;\;\;\frac{t}{b} - \frac{a}{b}\\

\mathbf{elif}\;\frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)} \le -8.00947989807014 \cdot 10^{-223}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x, y, z \cdot \left(t - a\right)\right) + z \cdot \mathsf{fma}\left(-\sqrt[3]{a}, \sqrt[3]{a} \cdot \sqrt[3]{a}, \sqrt[3]{a} \cdot \left(\sqrt[3]{a} \cdot \left(\sqrt[3]{\sqrt[3]{a} \cdot \sqrt[3]{a}} \cdot \sqrt[3]{\sqrt[3]{a}}\right)\right)\right)}{y + z \cdot \left(b - y\right)}\\

\mathbf{elif}\;\frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)} \le -0.0:\\
\;\;\;\;\frac{t}{b} - \frac{a}{b}\\

\mathbf{elif}\;\frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)} \le 1.37529062950492253 \cdot 10^{304}:\\
\;\;\;\;\frac{1}{\frac{\mathsf{fma}\left(z, b - y, y\right)}{\mathsf{fma}\left(x, y, z \cdot \left(t - a\right)\right)}}\\

\mathbf{else}:\\
\;\;\;\;\frac{t}{b} - \frac{a}{b}\\

\end{array}
double code(double x, double y, double z, double t, double a, double b) {
	return ((double) (((double) (((double) (x * y)) + ((double) (z * ((double) (t - a)))))) / ((double) (y + ((double) (z * ((double) (b - y))))))));
}
double code(double x, double y, double z, double t, double a, double b) {
	double VAR;
	if ((((double) (((double) (((double) (x * y)) + ((double) (z * ((double) (t - a)))))) / ((double) (y + ((double) (z * ((double) (b - y)))))))) <= -inf.0)) {
		VAR = ((double) (((double) (t / b)) - ((double) (a / b))));
	} else {
		double VAR_1;
		if ((((double) (((double) (((double) (x * y)) + ((double) (z * ((double) (t - a)))))) / ((double) (y + ((double) (z * ((double) (b - y)))))))) <= -8.00947989807014e-223)) {
			VAR_1 = ((double) (((double) (((double) fma(x, y, ((double) (z * ((double) (t - a)))))) + ((double) (z * ((double) fma(((double) -(((double) cbrt(a)))), ((double) (((double) cbrt(a)) * ((double) cbrt(a)))), ((double) (((double) cbrt(a)) * ((double) (((double) cbrt(a)) * ((double) (((double) cbrt(((double) (((double) cbrt(a)) * ((double) cbrt(a)))))) * ((double) cbrt(((double) cbrt(a)))))))))))))))) / ((double) (y + ((double) (z * ((double) (b - y))))))));
		} else {
			double VAR_2;
			if ((((double) (((double) (((double) (x * y)) + ((double) (z * ((double) (t - a)))))) / ((double) (y + ((double) (z * ((double) (b - y)))))))) <= -0.0)) {
				VAR_2 = ((double) (((double) (t / b)) - ((double) (a / b))));
			} else {
				double VAR_3;
				if ((((double) (((double) (((double) (x * y)) + ((double) (z * ((double) (t - a)))))) / ((double) (y + ((double) (z * ((double) (b - y)))))))) <= 1.3752906295049225e+304)) {
					VAR_3 = ((double) (1.0 / ((double) (((double) fma(z, ((double) (b - y)), y)) / ((double) fma(x, y, ((double) (z * ((double) (t - a))))))))));
				} else {
					VAR_3 = ((double) (((double) (t / b)) - ((double) (a / b))));
				}
				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

Original23.4
Target18.1
Herbie16.4
\[\frac{z \cdot t + y \cdot x}{y + z \cdot \left(b - y\right)} - \frac{a}{\left(b - y\right) + \frac{y}{z}}\]

Derivation

  1. Split input into 3 regimes
  2. if (/ (+ (* x y) (* z (- t a))) (+ y (* z (- b y)))) < -inf.0 or -8.00947989807014e-223 < (/ (+ (* x y) (* z (- t a))) (+ y (* z (- b y)))) < -0.0 or 1.3752906295049225e+304 < (/ (+ (* x y) (* z (- t a))) (+ y (* z (- b y))))

    1. Initial program 57.9

      \[\frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)}\]
    2. Using strategy rm
    3. Applied clear-num57.9

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

      \[\leadsto \frac{1}{\color{blue}{\frac{\mathsf{fma}\left(z, b - y, y\right)}{\mathsf{fma}\left(x, y, z \cdot \left(t - a\right)\right)}}}\]
    5. Taylor expanded around inf 40.1

      \[\leadsto \color{blue}{\frac{t}{b} - \frac{a}{b}}\]

    if -inf.0 < (/ (+ (* x y) (* z (- t a))) (+ y (* z (- b y)))) < -8.00947989807014e-223

    1. Initial program 0.3

      \[\frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)}\]
    2. Using strategy rm
    3. Applied add-cube-cbrt0.6

      \[\leadsto \frac{x \cdot y + z \cdot \left(t - \color{blue}{\left(\sqrt[3]{a} \cdot \sqrt[3]{a}\right) \cdot \sqrt[3]{a}}\right)}{y + z \cdot \left(b - y\right)}\]
    4. Applied add-sqr-sqrt31.6

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

      \[\leadsto \frac{x \cdot y + z \cdot \color{blue}{\left(\mathsf{fma}\left(\sqrt{t}, \sqrt{t}, -\sqrt[3]{a} \cdot \left(\sqrt[3]{a} \cdot \sqrt[3]{a}\right)\right) + \mathsf{fma}\left(-\sqrt[3]{a}, \sqrt[3]{a} \cdot \sqrt[3]{a}, \sqrt[3]{a} \cdot \left(\sqrt[3]{a} \cdot \sqrt[3]{a}\right)\right)\right)}}{y + z \cdot \left(b - y\right)}\]
    6. Applied distribute-lft-in31.6

      \[\leadsto \frac{x \cdot y + \color{blue}{\left(z \cdot \mathsf{fma}\left(\sqrt{t}, \sqrt{t}, -\sqrt[3]{a} \cdot \left(\sqrt[3]{a} \cdot \sqrt[3]{a}\right)\right) + z \cdot \mathsf{fma}\left(-\sqrt[3]{a}, \sqrt[3]{a} \cdot \sqrt[3]{a}, \sqrt[3]{a} \cdot \left(\sqrt[3]{a} \cdot \sqrt[3]{a}\right)\right)\right)}}{y + z \cdot \left(b - y\right)}\]
    7. Applied associate-+r+31.6

      \[\leadsto \frac{\color{blue}{\left(x \cdot y + z \cdot \mathsf{fma}\left(\sqrt{t}, \sqrt{t}, -\sqrt[3]{a} \cdot \left(\sqrt[3]{a} \cdot \sqrt[3]{a}\right)\right)\right) + z \cdot \mathsf{fma}\left(-\sqrt[3]{a}, \sqrt[3]{a} \cdot \sqrt[3]{a}, \sqrt[3]{a} \cdot \left(\sqrt[3]{a} \cdot \sqrt[3]{a}\right)\right)}}{y + z \cdot \left(b - y\right)}\]
    8. Simplified0.3

      \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(x, y, z \cdot \left(t - a\right)\right)} + z \cdot \mathsf{fma}\left(-\sqrt[3]{a}, \sqrt[3]{a} \cdot \sqrt[3]{a}, \sqrt[3]{a} \cdot \left(\sqrt[3]{a} \cdot \sqrt[3]{a}\right)\right)}{y + z \cdot \left(b - y\right)}\]
    9. Using strategy rm
    10. Applied add-cube-cbrt0.4

      \[\leadsto \frac{\mathsf{fma}\left(x, y, z \cdot \left(t - a\right)\right) + z \cdot \mathsf{fma}\left(-\sqrt[3]{a}, \sqrt[3]{a} \cdot \sqrt[3]{a}, \sqrt[3]{a} \cdot \left(\sqrt[3]{a} \cdot \sqrt[3]{\color{blue}{\left(\sqrt[3]{a} \cdot \sqrt[3]{a}\right) \cdot \sqrt[3]{a}}}\right)\right)}{y + z \cdot \left(b - y\right)}\]
    11. Applied cbrt-prod0.5

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

    if -0.0 < (/ (+ (* x y) (* z (- t a))) (+ y (* z (- b y)))) < 1.3752906295049225e+304

    1. Initial program 0.3

      \[\frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)}\]
    2. Using strategy rm
    3. Applied clear-num0.5

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)} = -\infty:\\ \;\;\;\;\frac{t}{b} - \frac{a}{b}\\ \mathbf{elif}\;\frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)} \le -8.00947989807014 \cdot 10^{-223}:\\ \;\;\;\;\frac{\mathsf{fma}\left(x, y, z \cdot \left(t - a\right)\right) + z \cdot \mathsf{fma}\left(-\sqrt[3]{a}, \sqrt[3]{a} \cdot \sqrt[3]{a}, \sqrt[3]{a} \cdot \left(\sqrt[3]{a} \cdot \left(\sqrt[3]{\sqrt[3]{a} \cdot \sqrt[3]{a}} \cdot \sqrt[3]{\sqrt[3]{a}}\right)\right)\right)}{y + z \cdot \left(b - y\right)}\\ \mathbf{elif}\;\frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)} \le -0.0:\\ \;\;\;\;\frac{t}{b} - \frac{a}{b}\\ \mathbf{elif}\;\frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)} \le 1.37529062950492253 \cdot 10^{304}:\\ \;\;\;\;\frac{1}{\frac{\mathsf{fma}\left(z, b - y, y\right)}{\mathsf{fma}\left(x, y, z \cdot \left(t - a\right)\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{t}{b} - \frac{a}{b}\\ \end{array}\]

Reproduce

herbie shell --seed 2020121 +o rules:numerics
(FPCore (x y z t a b)
  :name "Development.Shake.Progress:decay from shake-0.15.5"
  :precision binary64

  :herbie-target
  (- (/ (+ (* z t) (* y x)) (+ y (* z (- b y)))) (/ a (+ (- b y) (/ y z))))

  (/ (+ (* x y) (* z (- t a))) (+ y (* z (- b y)))))