Average Error: 23.1 → 5.7
Time: 16.6s
Precision: binary64
\[\frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)}\]
\[\begin{array}{l} \mathbf{if}\;z \leq -1.3995432802805447 \cdot 10^{+48}:\\ \;\;\;\;\frac{a}{y - b} - \frac{t}{y - b}\\ \mathbf{elif}\;z \leq 2.8616937025230026 \cdot 10^{+33}:\\ \;\;\;\;x \cdot \frac{y}{y + z \cdot \left(b - y\right)} + \frac{z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{y \cdot x}{y + z \cdot \left(b - y\right)} + \frac{t - a}{b - y}\\ \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 \leq -1.3995432802805447 \cdot 10^{+48}:\\
\;\;\;\;\frac{a}{y - b} - \frac{t}{y - b}\\

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

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

\end{array}
(FPCore (x y z t a b)
 :precision binary64
 (/ (+ (* x y) (* z (- t a))) (+ y (* z (- b y)))))
(FPCore (x y z t a b)
 :precision binary64
 (if (<= z -1.3995432802805447e+48)
   (- (/ a (- y b)) (/ t (- y b)))
   (if (<= z 2.8616937025230026e+33)
     (+ (* x (/ y (+ y (* z (- b y))))) (/ (* z (- t a)) (+ y (* z (- b y)))))
     (+ (/ (* y x) (+ y (* z (- b y)))) (/ (- t a) (- b y))))))
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 tmp;
	if (z <= -1.3995432802805447e+48) {
		tmp = (a / (y - b)) - (t / (y - b));
	} else if (z <= 2.8616937025230026e+33) {
		tmp = (x * (y / (y + (z * (b - y))))) + ((z * (t - a)) / (y + (z * (b - y))));
	} else {
		tmp = ((y * x) / (y + (z * (b - y)))) + ((t - a) / (b - y));
	}
	return tmp;
}

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.1
Target17.8
Herbie5.7
\[\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 z < -1.39954328028054468e48

    1. Initial program 42.9

      \[\frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)}\]
    2. Taylor expanded around 0 43.1

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

      \[\leadsto \color{blue}{\frac{x \cdot y}{y + z \cdot \left(b - y\right)} + \frac{z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)}}\]
    4. Taylor expanded around -inf 12.3

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

    if -1.39954328028054468e48 < z < 2.8616937025230026e33

    1. Initial program 9.6

      \[\frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)}\]
    2. Taylor expanded around 0 9.6

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

      \[\leadsto \color{blue}{\frac{x \cdot y}{y + z \cdot \left(b - y\right)} + \frac{z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)}}\]
    4. Using strategy rm
    5. Applied *-un-lft-identity_binary64_219029.6

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

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

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

    if 2.8616937025230026e33 < z

    1. Initial program 40.6

      \[\frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)}\]
    2. Taylor expanded around 0 40.9

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

      \[\leadsto \color{blue}{\frac{x \cdot y}{y + z \cdot \left(b - y\right)} + \frac{z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)}}\]
    4. Taylor expanded around inf 10.7

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.3995432802805447 \cdot 10^{+48}:\\ \;\;\;\;\frac{a}{y - b} - \frac{t}{y - b}\\ \mathbf{elif}\;z \leq 2.8616937025230026 \cdot 10^{+33}:\\ \;\;\;\;x \cdot \frac{y}{y + z \cdot \left(b - y\right)} + \frac{z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{y \cdot x}{y + z \cdot \left(b - y\right)} + \frac{t - a}{b - y}\\ \end{array}\]

Reproduce

herbie shell --seed 2020344 
(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)))))