Average Error: 23.4 → 15.0
Time: 16.8s
Precision: 64
\[\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)} = -\infty:\\ \;\;\;\;x\\ \mathbf{elif}\;\frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)} \le -4.673056284258433544652917082519281692767 \cdot 10^{-308} \lor \neg \left(\frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)} \le 4.262185374937676821653464069564696117094 \cdot 10^{-302}\right) \land \frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)} \le 9.664158567571915240588329897540394593936 \cdot 10^{256}:\\ \;\;\;\;\frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{t}{b} - \frac{a}{b}\\ \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)} = -\infty:\\
\;\;\;\;x\\

\mathbf{elif}\;\frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)} \le -4.673056284258433544652917082519281692767 \cdot 10^{-308} \lor \neg \left(\frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)} \le 4.262185374937676821653464069564696117094 \cdot 10^{-302}\right) \land \frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)} \le 9.664158567571915240588329897540394593936 \cdot 10^{256}:\\
\;\;\;\;\frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)}\\

\mathbf{else}:\\
\;\;\;\;\frac{t}{b} - \frac{a}{b}\\

\end{array}
double f(double x, double y, double z, double t, double a, double b) {
        double r669278 = x;
        double r669279 = y;
        double r669280 = r669278 * r669279;
        double r669281 = z;
        double r669282 = t;
        double r669283 = a;
        double r669284 = r669282 - r669283;
        double r669285 = r669281 * r669284;
        double r669286 = r669280 + r669285;
        double r669287 = b;
        double r669288 = r669287 - r669279;
        double r669289 = r669281 * r669288;
        double r669290 = r669279 + r669289;
        double r669291 = r669286 / r669290;
        return r669291;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r669292 = x;
        double r669293 = y;
        double r669294 = r669292 * r669293;
        double r669295 = z;
        double r669296 = t;
        double r669297 = a;
        double r669298 = r669296 - r669297;
        double r669299 = r669295 * r669298;
        double r669300 = r669294 + r669299;
        double r669301 = b;
        double r669302 = r669301 - r669293;
        double r669303 = r669295 * r669302;
        double r669304 = r669293 + r669303;
        double r669305 = r669300 / r669304;
        double r669306 = -inf.0;
        bool r669307 = r669305 <= r669306;
        double r669308 = -4.673056284258434e-308;
        bool r669309 = r669305 <= r669308;
        double r669310 = 4.262185374937677e-302;
        bool r669311 = r669305 <= r669310;
        double r669312 = !r669311;
        double r669313 = 9.664158567571915e+256;
        bool r669314 = r669305 <= r669313;
        bool r669315 = r669312 && r669314;
        bool r669316 = r669309 || r669315;
        double r669317 = r669296 / r669301;
        double r669318 = r669297 / r669301;
        double r669319 = r669317 - r669318;
        double r669320 = r669316 ? r669305 : r669319;
        double r669321 = r669307 ? r669292 : r669320;
        return r669321;
}

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.4
Target18.2
Herbie15.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 3 regimes
  2. if (/ (+ (* x y) (* z (- t a))) (+ y (* z (- 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 add-cube-cbrt64.0

      \[\leadsto \frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \color{blue}{\left(\left(\sqrt[3]{b - y} \cdot \sqrt[3]{b - y}\right) \cdot \sqrt[3]{b - y}\right)}}\]
    4. Applied associate-*r*64.0

      \[\leadsto \frac{x \cdot y + z \cdot \left(t - a\right)}{y + \color{blue}{\left(z \cdot \left(\sqrt[3]{b - y} \cdot \sqrt[3]{b - y}\right)\right) \cdot \sqrt[3]{b - y}}}\]
    5. Using strategy rm
    6. Applied clear-num64.0

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

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

      \[\leadsto \color{blue}{x}\]

    if -inf.0 < (/ (+ (* x y) (* z (- t a))) (+ y (* z (- b y)))) < -4.673056284258434e-308 or 4.262185374937677e-302 < (/ (+ (* x y) (* z (- t a))) (+ y (* z (- b y)))) < 9.664158567571915e+256

    1. Initial program 0.3

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

    if -4.673056284258434e-308 < (/ (+ (* x y) (* z (- t a))) (+ y (* z (- b y)))) < 4.262185374937677e-302 or 9.664158567571915e+256 < (/ (+ (* x y) (* z (- t a))) (+ y (* z (- b y))))

    1. Initial program 57.1

      \[\frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)}\]
    2. Using strategy rm
    3. Applied add-cube-cbrt57.1

      \[\leadsto \frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \color{blue}{\left(\left(\sqrt[3]{b - y} \cdot \sqrt[3]{b - y}\right) \cdot \sqrt[3]{b - y}\right)}}\]
    4. Applied associate-*r*57.1

      \[\leadsto \frac{x \cdot y + z \cdot \left(t - a\right)}{y + \color{blue}{\left(z \cdot \left(\sqrt[3]{b - y} \cdot \sqrt[3]{b - y}\right)\right) \cdot \sqrt[3]{b - y}}}\]
    5. Using strategy rm
    6. Applied clear-num57.2

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

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

      \[\leadsto \color{blue}{\frac{t}{b} - \frac{a}{b}}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification15.0

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)} = -\infty:\\ \;\;\;\;x\\ \mathbf{elif}\;\frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)} \le -4.673056284258433544652917082519281692767 \cdot 10^{-308} \lor \neg \left(\frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)} \le 4.262185374937676821653464069564696117094 \cdot 10^{-302}\right) \land \frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)} \le 9.664158567571915240588329897540394593936 \cdot 10^{256}:\\ \;\;\;\;\frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{t}{b} - \frac{a}{b}\\ \end{array}\]

Reproduce

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