Average Error: 22.7 → 19.2
Time: 2.2m
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 -2.10529586811968693 \cdot 10^{131} \lor \neg \left(z \le 4.85537482711178077 \cdot 10^{196}\right):\\ \;\;\;\;\frac{t}{b} - \frac{a}{b}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{\mathsf{fma}\left(b - y, z, y\right)}{\mathsf{fma}\left(x, y, z \cdot \left(t - a\right)\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 -2.10529586811968693 \cdot 10^{131} \lor \neg \left(z \le 4.85537482711178077 \cdot 10^{196}\right):\\
\;\;\;\;\frac{t}{b} - \frac{a}{b}\\

\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{\mathsf{fma}\left(b - y, z, y\right)}{\mathsf{fma}\left(x, y, z \cdot \left(t - a\right)\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 <= -2.105295868119687e+131) || !(z <= 4.855374827111781e+196))) {
		temp = ((t / b) - (a / b));
	} else {
		temp = (1.0 / (fma((b - y), z, y) / fma(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

Original22.7
Target17.8
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 < -2.105295868119687e+131 or 4.855374827111781e+196 < z

    1. Initial program 49.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-num49.9

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

      \[\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 33.6

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

    if -2.105295868119687e+131 < z < 4.855374827111781e+196

    1. Initial program 14.8

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

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

      \[\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)}}}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification19.2

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

Reproduce

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