Average Error: 22.4 → 20.5
Time: 25.6s
Precision: 64
\[\frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)}\]
\[\begin{array}{l} \mathbf{if}\;z \le -5.062409672741701 \cdot 10^{+211}:\\ \;\;\;\;\frac{t}{b} - \frac{a}{b}\\ \mathbf{elif}\;z \le -1.5073212909314457 \cdot 10^{-240}:\\ \;\;\;\;\frac{1}{\frac{\mathsf{fma}\left(b - y, z, y\right)}{\mathsf{fma}\left(y, x, z \cdot \left(t - a\right)\right)}}\\ \mathbf{elif}\;z \le 5.972417992529298 \cdot 10^{-285}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \le 8.879606465820762 \cdot 10^{+192}:\\ \;\;\;\;\mathsf{fma}\left(z, t - a, x \cdot y\right) \cdot \frac{1}{\mathsf{fma}\left(z, b - y, 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}\;z \le -5.062409672741701 \cdot 10^{+211}:\\
\;\;\;\;\frac{t}{b} - \frac{a}{b}\\

\mathbf{elif}\;z \le -1.5073212909314457 \cdot 10^{-240}:\\
\;\;\;\;\frac{1}{\frac{\mathsf{fma}\left(b - y, z, y\right)}{\mathsf{fma}\left(y, x, z \cdot \left(t - a\right)\right)}}\\

\mathbf{elif}\;z \le 5.972417992529298 \cdot 10^{-285}:\\
\;\;\;\;x\\

\mathbf{elif}\;z \le 8.879606465820762 \cdot 10^{+192}:\\
\;\;\;\;\mathsf{fma}\left(z, t - a, x \cdot y\right) \cdot \frac{1}{\mathsf{fma}\left(z, b - y, 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 r36515996 = x;
        double r36515997 = y;
        double r36515998 = r36515996 * r36515997;
        double r36515999 = z;
        double r36516000 = t;
        double r36516001 = a;
        double r36516002 = r36516000 - r36516001;
        double r36516003 = r36515999 * r36516002;
        double r36516004 = r36515998 + r36516003;
        double r36516005 = b;
        double r36516006 = r36516005 - r36515997;
        double r36516007 = r36515999 * r36516006;
        double r36516008 = r36515997 + r36516007;
        double r36516009 = r36516004 / r36516008;
        return r36516009;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r36516010 = z;
        double r36516011 = -5.062409672741701e+211;
        bool r36516012 = r36516010 <= r36516011;
        double r36516013 = t;
        double r36516014 = b;
        double r36516015 = r36516013 / r36516014;
        double r36516016 = a;
        double r36516017 = r36516016 / r36516014;
        double r36516018 = r36516015 - r36516017;
        double r36516019 = -1.5073212909314457e-240;
        bool r36516020 = r36516010 <= r36516019;
        double r36516021 = 1.0;
        double r36516022 = y;
        double r36516023 = r36516014 - r36516022;
        double r36516024 = fma(r36516023, r36516010, r36516022);
        double r36516025 = x;
        double r36516026 = r36516013 - r36516016;
        double r36516027 = r36516010 * r36516026;
        double r36516028 = fma(r36516022, r36516025, r36516027);
        double r36516029 = r36516024 / r36516028;
        double r36516030 = r36516021 / r36516029;
        double r36516031 = 5.972417992529298e-285;
        bool r36516032 = r36516010 <= r36516031;
        double r36516033 = 8.879606465820762e+192;
        bool r36516034 = r36516010 <= r36516033;
        double r36516035 = r36516025 * r36516022;
        double r36516036 = fma(r36516010, r36516026, r36516035);
        double r36516037 = fma(r36516010, r36516023, r36516022);
        double r36516038 = r36516021 / r36516037;
        double r36516039 = r36516036 * r36516038;
        double r36516040 = r36516034 ? r36516039 : r36516018;
        double r36516041 = r36516032 ? r36516025 : r36516040;
        double r36516042 = r36516020 ? r36516030 : r36516041;
        double r36516043 = r36516012 ? r36516018 : r36516042;
        return r36516043;
}

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

Target

Original22.4
Target17.5
Herbie20.5
\[\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 z < -5.062409672741701e+211 or 8.879606465820762e+192 < z

    1. Initial program 50.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-num50.1

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

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

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

    if -5.062409672741701e+211 < z < -1.5073212909314457e-240

    1. Initial program 19.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-num19.5

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

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

    if -1.5073212909314457e-240 < z < 5.972417992529298e-285

    1. Initial program 8.3

      \[\frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)}\]
    2. Using strategy rm
    3. Applied clear-num8.4

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

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

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

    if 5.972417992529298e-285 < z < 8.879606465820762e+192

    1. Initial program 16.6

      \[\frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)}\]
    2. Using strategy rm
    3. Applied clear-num16.7

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

      \[\leadsto \frac{1}{\color{blue}{\frac{\mathsf{fma}\left(b - y, z, y\right)}{\mathsf{fma}\left(y, x, z \cdot \left(t - a\right)\right)}}}\]
    5. Using strategy rm
    6. Applied div-inv16.8

      \[\leadsto \frac{1}{\color{blue}{\mathsf{fma}\left(b - y, z, y\right) \cdot \frac{1}{\mathsf{fma}\left(y, x, z \cdot \left(t - a\right)\right)}}}\]
    7. Applied add-cube-cbrt16.8

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

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

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

      \[\leadsto \frac{1}{\mathsf{fma}\left(z, b - y, y\right)} \cdot \color{blue}{\mathsf{fma}\left(z, t - a, x \cdot y\right)}\]
  3. Recombined 4 regimes into one program.
  4. Final simplification20.5

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le -5.062409672741701 \cdot 10^{+211}:\\ \;\;\;\;\frac{t}{b} - \frac{a}{b}\\ \mathbf{elif}\;z \le -1.5073212909314457 \cdot 10^{-240}:\\ \;\;\;\;\frac{1}{\frac{\mathsf{fma}\left(b - y, z, y\right)}{\mathsf{fma}\left(y, x, z \cdot \left(t - a\right)\right)}}\\ \mathbf{elif}\;z \le 5.972417992529298 \cdot 10^{-285}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \le 8.879606465820762 \cdot 10^{+192}:\\ \;\;\;\;\mathsf{fma}\left(z, t - a, x \cdot y\right) \cdot \frac{1}{\mathsf{fma}\left(z, b - y, y\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{t}{b} - \frac{a}{b}\\ \end{array}\]

Reproduce

herbie shell --seed 2019163 +o rules:numerics
(FPCore (x y z t a b)
  :name "Development.Shake.Progress:decay from shake-0.15.5"

  :herbie-target
  (- (/ (+ (* z t) (* y x)) (+ y (* z (- b y)))) (/ a (+ (- b y) (/ y z))))

  (/ (+ (* x y) (* z (- t a))) (+ y (* z (- b y)))))