Average Error: 23.6 → 9.0
Time: 20.0s
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 -1.220083076971846 \cdot 10^{-305}:\\ \;\;\;\;\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 4.2468170290582 \cdot 10^{-264} \lor \neg \left(\frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)} \leq 5.3845066995653086 \cdot 10^{+305}\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 -1.220083076971846 \cdot 10^{-305}:\\
\;\;\;\;\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 4.2468170290582 \cdot 10^{-264} \lor \neg \left(\frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)} \leq 5.3845066995653086 \cdot 10^{+305}\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))))
        -1.220083076971846e-305)
     (-
      (+
       (/ (* 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))))
              4.2468170290582e-264)
             (not
              (<=
               (/ (+ (* x y) (* z (- t a))) (+ y (* z (- b y))))
               5.3845066995653086e+305)))
       (/ (- 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)))) <= -1.220083076971846e-305) {
		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)))) <= 4.2468170290582e-264) || !((((x * y) + (z * (t - a))) / (y + (z * (b - y)))) <= 5.3845066995653086e+305)) {
		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.6
Target18.4
Herbie9.0
\[\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 30.2

      \[\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)))) < -1.22008307697184588e-305

    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 -1.22008307697184588e-305 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < 4.2468170290582001e-264 or 5.3845066995653086e305 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y))))

    1. Initial program 57.3

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

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

    if 4.2468170290582001e-264 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < 5.3845066995653086e305

    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 simplification9.0

    \[\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 -1.220083076971846 \cdot 10^{-305}:\\ \;\;\;\;\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 4.2468170290582 \cdot 10^{-264} \lor \neg \left(\frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)} \leq 5.3845066995653086 \cdot 10^{+305}\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 2021014 
(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)))))