Average Error: 23.1 → 8.4
Time: 58.1s
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}{1 - z}\\ \mathbf{elif}\;\frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)} \leq -2.2095971443946154 \cdot 10^{-290}:\\ \;\;\;\;\left(\frac{z \cdot t}{\left(y + z \cdot b\right) - y \cdot z} + \frac{x \cdot y}{\left(y + z \cdot b\right) - y \cdot z}\right) - \frac{z \cdot a}{\left(y + z \cdot b\right) - y \cdot z}\\ \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 3.477208287338133 \cdot 10^{+304}\right):\\ \;\;\;\;\frac{t - a}{b - y}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot y + 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}{1 - z}\\

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

\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 3.477208287338133 \cdot 10^{+304}\right):\\
\;\;\;\;\frac{t - a}{b - y}\\

\mathbf{else}:\\
\;\;\;\;\frac{x \cdot y + 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 (- 1.0 z))
   (if (<=
        (/ (+ (* x y) (* z (- t a))) (+ y (* z (- b y))))
        -2.2095971443946154e-290)
     (-
      (+
       (/ (* z t) (- (+ y (* z b)) (* y z)))
       (/ (* x y) (- (+ y (* z b)) (* y z))))
      (/ (* z 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))))
               3.477208287338133e+304)))
       (/ (- t a) (- b y))
       (/ (+ (* x 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 / (1.0 - z);
	} else if ((((x * y) + (z * (t - a))) / (y + (z * (b - y)))) <= -2.2095971443946154e-290) {
		tmp = (((z * t) / ((y + (z * b)) - (y * z))) + ((x * y) / ((y + (z * b)) - (y * z)))) - ((z * 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)))) <= 3.477208287338133e+304)) {
		tmp = (t - a) / (b - y);
	} else {
		tmp = ((x * 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.1
Target17.9
Herbie8.4
\[\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. Taylor expanded around inf 29.1

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

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

    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 \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}}\]

    if -2.2095971443946154e-290 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < 0.0 or 3.4772082873381331e304 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y))))

    1. Initial program 58.3

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

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

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

    1. Initial program 0.3

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

    \[\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}{1 - z}\\ \mathbf{elif}\;\frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)} \leq -2.2095971443946154 \cdot 10^{-290}:\\ \;\;\;\;\left(\frac{z \cdot t}{\left(y + z \cdot b\right) - y \cdot z} + \frac{x \cdot y}{\left(y + z \cdot b\right) - y \cdot z}\right) - \frac{z \cdot a}{\left(y + z \cdot b\right) - y \cdot z}\\ \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 3.477208287338133 \cdot 10^{+304}\right):\\ \;\;\;\;\frac{t - a}{b - y}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)}\\ \end{array}\]

Reproduce

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