Average Error: 23.3 → 8.9
Time: 21.3s
Precision: binary64
Cost: 6154
\[\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{t - a}{b - y}\\ \mathbf{elif}\;\frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)} \leq -8.868229609988521 \cdot 10^{-308}:\\ \;\;\;\;\frac{1}{\left(\frac{y}{x \cdot y + z \cdot \left(t - a\right)} + \frac{z \cdot b}{x \cdot y + z \cdot \left(t - a\right)}\right) - \frac{y \cdot z}{x \cdot y + z \cdot \left(t - a\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 9.918042372221392 \cdot 10^{+290}\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{t - a}{b - y}\\

\mathbf{elif}\;\frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)} \leq -8.868229609988521 \cdot 10^{-308}:\\
\;\;\;\;\frac{1}{\left(\frac{y}{x \cdot y + z \cdot \left(t - a\right)} + \frac{z \cdot b}{x \cdot y + z \cdot \left(t - a\right)}\right) - \frac{y \cdot z}{x \cdot y + z \cdot \left(t - a\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 9.918042372221392 \cdot 10^{+290}\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))
   (/ (- t a) (- b y))
   (if (<=
        (/ (+ (* x y) (* z (- t a))) (+ y (* z (- b y))))
        -8.868229609988521e-308)
     (/
      1.0
      (-
       (+
        (/ y (+ (* x y) (* z (- t a))))
        (/ (* z b) (+ (* x y) (* z (- t a)))))
       (/ (* y z) (+ (* x y) (* z (- t a))))))
     (if (or (<= (/ (+ (* x y) (* z (- t a))) (+ y (* z (- b y)))) 0.0)
             (not
              (<=
               (/ (+ (* x y) (* z (- t a))) (+ y (* z (- b y))))
               9.918042372221392e+290)))
       (/ (- 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 = (t - a) / (b - y);
	} else if ((((x * y) + (z * (t - a))) / (y + (z * (b - y)))) <= -8.868229609988521e-308) {
		tmp = 1.0 / (((y / ((x * y) + (z * (t - a)))) + ((z * b) / ((x * y) + (z * (t - a))))) - ((y * z) / ((x * y) + (z * (t - a)))));
	} else if (((((x * y) + (z * (t - a))) / (y + (z * (b - y)))) <= 0.0) || !((((x * y) + (z * (t - a))) / (y + (z * (b - y)))) <= 9.918042372221392e+290)) {
		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.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}}\]

Alternatives

Alternative 1
Error8.8
Cost5777
\[\begin{array}{l} \mathbf{if}\;\frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)} \leq -\infty \lor \neg \left(\frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)} \leq -8.868229609988521 \cdot 10^{-308} \lor \neg \left(\frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)} \leq 0\right) \land \frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)} \leq 9.918042372221392 \cdot 10^{+290}\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}\]
Alternative 2
Error20.5
Cost1416
\[\begin{array}{l} \mathbf{if}\;z \leq -1090010360205297.6 \lor \neg \left(z \leq 1.9694237423089422 \cdot 10^{-88}\right):\\ \;\;\;\;\frac{t - a}{b - y}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{y - y \cdot z}{x \cdot y + z \cdot \left(t - a\right)}}\\ \end{array}\]
Alternative 3
Error20.5
Cost1160
\[\begin{array}{l} \mathbf{if}\;z \leq -0.04340658185522825 \lor \neg \left(z \leq 1.2187309501441571 \cdot 10^{-89}\right):\\ \;\;\;\;\frac{t - a}{b - y}\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot y + z \cdot \left(t - a\right)\right) \cdot \frac{1}{y}\\ \end{array}\]
Alternative 4
Error21.6
Cost1795
\[\begin{array}{l} \mathbf{if}\;z \leq -3245.394753813225:\\ \;\;\;\;\frac{t - a}{b - y}\\ \mathbf{elif}\;z \leq 3.0137540752741964 \cdot 10^{-130}:\\ \;\;\;\;\frac{x}{1 - z}\\ \mathbf{elif}\;z \leq 24471426565494.156:\\ \;\;\;\;\frac{z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{t - a}{b - y}\\ \end{array}\]
Alternative 5
Error22.8
Cost776
\[\begin{array}{l} \mathbf{if}\;z \leq -1.2903271998760588 \lor \neg \left(z \leq 3.5374700614535805 \cdot 10^{-100}\right):\\ \;\;\;\;\frac{t - a}{b - y}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{1 - z}\\ \end{array}\]
Alternative 6
Error41.7
Cost320
\[\frac{x}{1 - z}\]
Alternative 7
Error46.5
Cost64
\[x\]
Alternative 8
Error60.7
Cost64
\[0\]
Alternative 9
Error61.6
Cost64
\[1\]

Error

Derivation

  1. Split input into 3 regimes
  2. if (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < -inf.0 or -8.86822960998852061e-308 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < 0.0 or 9.9180423722213923e290 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y))))

    1. Initial program 59.3

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

      \[\leadsto \color{blue}{\frac{t - a}{b - y}}\]
    3. Simplified22.1

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

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

    1. Initial program 0.4

      \[\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_binary64_208780.5

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

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

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

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

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

    1. Initial program 0.3

      \[\frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)}\]
    2. Simplified0.3

      \[\leadsto \color{blue}{\frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)}}\]
  3. Recombined 3 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{t - a}{b - y}\\ \mathbf{elif}\;\frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)} \leq -8.868229609988521 \cdot 10^{-308}:\\ \;\;\;\;\frac{1}{\left(\frac{y}{x \cdot y + z \cdot \left(t - a\right)} + \frac{z \cdot b}{x \cdot y + z \cdot \left(t - a\right)}\right) - \frac{y \cdot z}{x \cdot y + z \cdot \left(t - a\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 9.918042372221392 \cdot 10^{+290}\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 2021044 
(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)))))