Average Error: 23.4 → 19.9
Time: 8.2s
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 -1.1016366134119363 \cdot 10^{217} \lor \neg \left(z \le 3.9048530732432371 \cdot 10^{76}\right):\\ \;\;\;\;\frac{t}{b} - \frac{a}{b}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{y + z \cdot \left(b - y\right)}{x \cdot y + z \cdot \left(t - a\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 -1.1016366134119363 \cdot 10^{217} \lor \neg \left(z \le 3.9048530732432371 \cdot 10^{76}\right):\\
\;\;\;\;\frac{t}{b} - \frac{a}{b}\\

\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{y + z \cdot \left(b - y\right)}{x \cdot y + z \cdot \left(t - a\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 <= -1.1016366134119363e+217) || !(z <= 3.904853073243237e+76))) {
		temp = ((t / b) - (a / b));
	} else {
		temp = (1.0 / ((y + (z * (b - y))) / ((x * y) + (z * (t - a)))));
	}
	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

Original23.4
Target18.5
Herbie19.9
\[\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 < -1.1016366134119363e+217 or 3.904853073243237e+76 < z

    1. Initial program 47.7

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

      \[\leadsto \color{blue}{\frac{1}{\frac{y + z \cdot \left(b - y\right)}{x \cdot y + z \cdot \left(t - a\right)}}}\]
    4. Using strategy rm
    5. Applied div-inv47.7

      \[\leadsto \frac{1}{\color{blue}{\left(y + z \cdot \left(b - y\right)\right) \cdot \frac{1}{x \cdot y + z \cdot \left(t - a\right)}}}\]
    6. Applied add-sqr-sqrt47.7

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

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

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

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

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

    if -1.1016366134119363e+217 < z < 3.904853073243237e+76

    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 clear-num15.5

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le -1.1016366134119363 \cdot 10^{217} \lor \neg \left(z \le 3.9048530732432371 \cdot 10^{76}\right):\\ \;\;\;\;\frac{t}{b} - \frac{a}{b}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{y + z \cdot \left(b - y\right)}{x \cdot y + z \cdot \left(t - a\right)}}\\ \end{array}\]

Reproduce

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