Average Error: 23.3 → 8.9
Time: 26.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}\;\frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)} \leq -\infty:\\ \;\;\;\;-\frac{x}{z + -1}\\ \mathbf{elif}\;\frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)} \leq -2.7646989191220188 \cdot 10^{-307}:\\ \;\;\;\;\frac{x \cdot y + z \cdot \left(t - a\right)}{y + \left(z \cdot b - y \cdot z\right)}\\ \mathbf{elif}\;\frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)} \leq 0 \lor \neg \left(\frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)} \leq 1.1752269890446499 \cdot 10^{+300}\right):\\ \;\;\;\;\frac{a - t}{y - b}\\ \mathbf{else}:\\ \;\;\;\;\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)}\\ \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)} \leq -\infty:\\
\;\;\;\;-\frac{x}{z + -1}\\

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

\mathbf{elif}\;\frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)} \leq 0 \lor \neg \left(\frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)} \leq 1.1752269890446499 \cdot 10^{+300}\right):\\
\;\;\;\;\frac{a - t}{y - b}\\

\mathbf{else}:\\
\;\;\;\;\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)}\\

\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 (<= (/ (+ (* x y) (* z (- t a))) (+ y (* z (- b y)))) (- INFINITY))
   (- (/ x (+ z -1.0)))
   (if (<=
        (/ (+ (* x y) (* z (- t a))) (+ y (* z (- b y))))
        -2.7646989191220188e-307)
     (/ (+ (* x y) (* z (- t a))) (+ y (- (* z b) (* y z))))
     (if (or (<= (/ (+ (* x y) (* z (- t a))) (+ y (* z (- b y)))) 0.0)
             (not
              (<=
               (/ (+ (* x y) (* z (- t a))) (+ y (* z (- b y))))
               1.1752269890446499e+300)))
       (/ (- a t) (- y b))
       (+
        (/ (* x y) (+ y (* z (- b y))))
        (/ (* z (- t a)) (+ y (* z (- 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 ((((x * y) + (z * (t - a))) / (y + (z * (b - y)))) <= -((double) INFINITY)) {
		tmp = -(x / (z + -1.0));
	} else if ((((x * y) + (z * (t - a))) / (y + (z * (b - y)))) <= -2.7646989191220188e-307) {
		tmp = ((x * y) + (z * (t - a))) / (y + ((z * b) - (y * z)));
	} else if (((((x * y) + (z * (t - a))) / (y + (z * (b - y)))) <= 0.0) || !((((x * y) + (z * (t - a))) / (y + (z * (b - y)))) <= 1.1752269890446499e+300)) {
		tmp = (a - t) / (y - b);
	} else {
		tmp = ((x * y) / (y + (z * (b - y)))) + ((z * (t - a)) / (y + (z * (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.3
Target17.9
Herbie8.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 4 regimes
  2. if (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < -inf.0

    1. Initial program 64.0

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

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

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

      \[\leadsto \color{blue}{-1 \cdot \frac{x}{z - 1}}\]

    if -inf.0 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < -2.7646989191220188e-307

    1. Initial program 0.3

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

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

    if -2.7646989191220188e-307 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < 0.0 or 1.1752269890446499e300 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y))))

    1. Initial program 58.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-num_binary6458.8

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

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

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

    if 0.0 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < 1.1752269890446499e300

    1. Initial program 0.4

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

      \[\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. Simplified0.4

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)} \leq -\infty:\\ \;\;\;\;-\frac{x}{z + -1}\\ \mathbf{elif}\;\frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)} \leq -2.7646989191220188 \cdot 10^{-307}:\\ \;\;\;\;\frac{x \cdot y + z \cdot \left(t - a\right)}{y + \left(z \cdot b - y \cdot z\right)}\\ \mathbf{elif}\;\frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)} \leq 0 \lor \neg \left(\frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)} \leq 1.1752269890446499 \cdot 10^{+300}\right):\\ \;\;\;\;\frac{a - t}{y - b}\\ \mathbf{else}:\\ \;\;\;\;\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)}\\ \end{array}\]

Reproduce

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