Average Error: 22.4 → 19.2
Time: 7.9s
Precision: 64
\[\frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)}\]
\[\begin{array}{l} \mathbf{if}\;z \le -3.79681007453336803 \cdot 10^{235} \lor \neg \left(z \le 9.3702509275758488 \cdot 10^{111}\right):\\ \;\;\;\;\frac{t}{b} - \frac{a}{b}\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(-z, t - a, -x \cdot y\right)}{-\mathsf{fma}\left(b - y, z, y\right)}\\ \end{array}\]
\frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)}
\begin{array}{l}
\mathbf{if}\;z \le -3.79681007453336803 \cdot 10^{235} \lor \neg \left(z \le 9.3702509275758488 \cdot 10^{111}\right):\\
\;\;\;\;\frac{t}{b} - \frac{a}{b}\\

\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-z, t - a, -x \cdot y\right)}{-\mathsf{fma}\left(b - y, z, y\right)}\\

\end{array}
double code(double x, double y, double z, double t, double a, double b) {
	return (((x * y) + (z * (t - a))) / (y + (z * (b - y))));
}
double code(double x, double y, double z, double t, double a, double b) {
	double temp;
	if (((z <= -3.796810074533368e+235) || !(z <= 9.370250927575849e+111))) {
		temp = ((t / b) - (a / b));
	} else {
		temp = (fma(-z, (t - a), -(x * y)) / -fma((b - y), z, y));
	}
	return temp;
}

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

Original22.4
Target17.3
Herbie19.2
\[\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 2 regimes
  2. if z < -3.796810074533368e+235 or 9.370250927575849e+111 < z

    1. Initial program 49.2

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

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

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

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

    if -3.796810074533368e+235 < z < 9.370250927575849e+111

    1. Initial program 15.3

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

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

      \[\leadsto \left(x \cdot y + z \cdot \left(t - a\right)\right) \cdot \color{blue}{\frac{1}{\mathsf{fma}\left(b - y, z, y\right)}}\]
    5. Using strategy rm
    6. Applied add-cube-cbrt15.8

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

      \[\leadsto \left(x \cdot y + \color{blue}{\left(z \cdot \left(\sqrt[3]{t - a} \cdot \sqrt[3]{t - a}\right)\right) \cdot \sqrt[3]{t - a}}\right) \cdot \frac{1}{\mathsf{fma}\left(b - y, z, y\right)}\]
    8. Using strategy rm
    9. Applied frac-2neg15.8

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le -3.79681007453336803 \cdot 10^{235} \lor \neg \left(z \le 9.3702509275758488 \cdot 10^{111}\right):\\ \;\;\;\;\frac{t}{b} - \frac{a}{b}\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(-z, t - a, -x \cdot y\right)}{-\mathsf{fma}\left(b - y, z, y\right)}\\ \end{array}\]

Reproduce

herbie shell --seed 2020066 +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)))))