Average Error: 23.0 → 20.9
Time: 25.7s
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 1.351133986214442027709926082643655611192 \cdot 10^{146}:\\ \;\;\;\;\frac{\mathsf{fma}\left(y, x, \left(t - a\right) \cdot z\right)}{\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 1.351133986214442027709926082643655611192 \cdot 10^{146}:\\
\;\;\;\;\frac{\mathsf{fma}\left(y, x, \left(t - a\right) \cdot z\right)}{\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 r35451899 = x;
        double r35451900 = y;
        double r35451901 = r35451899 * r35451900;
        double r35451902 = z;
        double r35451903 = t;
        double r35451904 = a;
        double r35451905 = r35451903 - r35451904;
        double r35451906 = r35451902 * r35451905;
        double r35451907 = r35451901 + r35451906;
        double r35451908 = b;
        double r35451909 = r35451908 - r35451900;
        double r35451910 = r35451902 * r35451909;
        double r35451911 = r35451900 + r35451910;
        double r35451912 = r35451907 / r35451911;
        return r35451912;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r35451913 = z;
        double r35451914 = 1.351133986214442e+146;
        bool r35451915 = r35451913 <= r35451914;
        double r35451916 = y;
        double r35451917 = x;
        double r35451918 = t;
        double r35451919 = a;
        double r35451920 = r35451918 - r35451919;
        double r35451921 = r35451920 * r35451913;
        double r35451922 = fma(r35451916, r35451917, r35451921);
        double r35451923 = b;
        double r35451924 = r35451923 - r35451916;
        double r35451925 = fma(r35451913, r35451924, r35451916);
        double r35451926 = r35451922 / r35451925;
        double r35451927 = r35451918 / r35451923;
        double r35451928 = r35451919 / r35451923;
        double r35451929 = r35451927 - r35451928;
        double r35451930 = r35451915 ? r35451926 : r35451929;
        return r35451930;
}

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

Original23.0
Target17.7
Herbie20.9
\[\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 2 regimes
  2. if z < 1.351133986214442e+146

    1. Initial program 19.1

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

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

    if 1.351133986214442e+146 < z

    1. Initial program 49.0

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

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(y, x, z \cdot \left(t - a\right)\right)}{\mathsf{fma}\left(z, b - y, y\right)}}\]
    3. Using strategy rm
    4. Applied clear-num49.0

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le 1.351133986214442027709926082643655611192 \cdot 10^{146}:\\ \;\;\;\;\frac{\mathsf{fma}\left(y, x, \left(t - a\right) \cdot z\right)}{\mathsf{fma}\left(z, b - y, y\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{t}{b} - \frac{a}{b}\\ \end{array}\]

Reproduce

herbie shell --seed 2019192 +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)))))