Average Error: 23.2 → 15.0
Time: 8.4s
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 -7.09669501949738936499941568471402397685 \cdot 10^{-293}:\\ \;\;\;\;\frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)}\\ \mathbf{elif}\;\frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)} \le 0.0:\\ \;\;\;\;\frac{t}{b} - \frac{a}{b}\\ \mathbf{elif}\;\frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)} \le 3.365170107416157809932424091751188734223 \cdot 10^{290}:\\ \;\;\;\;\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 -7.09669501949738936499941568471402397685 \cdot 10^{-293}:\\
\;\;\;\;\frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)}\\

\mathbf{elif}\;\frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)} \le 0.0:\\
\;\;\;\;\frac{t}{b} - \frac{a}{b}\\

\mathbf{elif}\;\frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)} \le 3.365170107416157809932424091751188734223 \cdot 10^{290}:\\
\;\;\;\;\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 r840469 = x;
        double r840470 = y;
        double r840471 = r840469 * r840470;
        double r840472 = z;
        double r840473 = t;
        double r840474 = a;
        double r840475 = r840473 - r840474;
        double r840476 = r840472 * r840475;
        double r840477 = r840471 + r840476;
        double r840478 = b;
        double r840479 = r840478 - r840470;
        double r840480 = r840472 * r840479;
        double r840481 = r840470 + r840480;
        double r840482 = r840477 / r840481;
        return r840482;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r840483 = x;
        double r840484 = y;
        double r840485 = r840483 * r840484;
        double r840486 = z;
        double r840487 = t;
        double r840488 = a;
        double r840489 = r840487 - r840488;
        double r840490 = r840486 * r840489;
        double r840491 = r840485 + r840490;
        double r840492 = b;
        double r840493 = r840492 - r840484;
        double r840494 = r840486 * r840493;
        double r840495 = r840484 + r840494;
        double r840496 = r840491 / r840495;
        double r840497 = -inf.0;
        bool r840498 = r840496 <= r840497;
        double r840499 = -7.096695019497389e-293;
        bool r840500 = r840496 <= r840499;
        double r840501 = 0.0;
        bool r840502 = r840496 <= r840501;
        double r840503 = r840487 / r840492;
        double r840504 = r840488 / r840492;
        double r840505 = r840503 - r840504;
        double r840506 = 3.365170107416158e+290;
        bool r840507 = r840496 <= r840506;
        double r840508 = r840507 ? r840496 : r840505;
        double r840509 = r840502 ? r840505 : r840508;
        double r840510 = r840500 ? r840496 : r840509;
        double r840511 = r840498 ? r840483 : r840510;
        return r840511;
}

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.2
Target18.0
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 clear-num64.0

      \[\leadsto \color{blue}{\frac{1}{\frac{y + z \cdot \left(b - y\right)}{x \cdot y + z \cdot \left(t - a\right)}}}\]
    4. Using strategy rm
    5. Applied div-inv64.0

      \[\leadsto \frac{1}{\color{blue}{\left(y + z \cdot \left(b - y\right)\right) \cdot \frac{1}{x \cdot y + z \cdot \left(t - a\right)}}}\]
    6. Applied add-cube-cbrt64.0

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

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

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

      \[\leadsto \frac{1}{\mathsf{fma}\left(b - y, z, y\right)} \cdot \color{blue}{\mathsf{fma}\left(x, y, z \cdot \left(t - a\right)\right)}\]
    10. Taylor expanded around 0 37.6

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

    if -inf.0 < (/ (+ (* x y) (* z (- t a))) (+ y (* z (- b y)))) < -7.096695019497389e-293 or 0.0 < (/ (+ (* x y) (* z (- t a))) (+ y (* z (- b y)))) < 3.365170107416158e+290

    1. Initial program 3.6

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

    if -7.096695019497389e-293 < (/ (+ (* x y) (* z (- t a))) (+ y (* z (- b y)))) < 0.0 or 3.365170107416158e+290 < (/ (+ (* x y) (* z (- t a))) (+ y (* z (- b y))))

    1. Initial program 59.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-num59.7

      \[\leadsto \color{blue}{\frac{1}{\frac{y + z \cdot \left(b - y\right)}{x \cdot y + z \cdot \left(t - a\right)}}}\]
    4. Using strategy rm
    5. Applied div-inv59.7

      \[\leadsto \frac{1}{\color{blue}{\left(y + z \cdot \left(b - y\right)\right) \cdot \frac{1}{x \cdot y + z \cdot \left(t - a\right)}}}\]
    6. Applied add-cube-cbrt59.7

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

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

      \[\leadsto \color{blue}{\frac{1}{\mathsf{fma}\left(b - y, z, y\right)}} \cdot \frac{\sqrt[3]{1}}{\frac{1}{x \cdot y + z \cdot \left(t - a\right)}}\]
    9. Simplified59.7

      \[\leadsto \frac{1}{\mathsf{fma}\left(b - y, z, y\right)} \cdot \color{blue}{\mathsf{fma}\left(x, y, z \cdot \left(t - a\right)\right)}\]
    10. Taylor expanded around inf 39.7

      \[\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 -7.09669501949738936499941568471402397685 \cdot 10^{-293}:\\ \;\;\;\;\frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)}\\ \mathbf{elif}\;\frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)} \le 0.0:\\ \;\;\;\;\frac{t}{b} - \frac{a}{b}\\ \mathbf{elif}\;\frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)} \le 3.365170107416157809932424091751188734223 \cdot 10^{290}:\\ \;\;\;\;\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 2020001 +o rules:numerics
(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)))))