Average Error: 24.0 → 22.2
Time: 25.1s
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 4.087544577176839063520473760807451583614 \cdot 10^{-280}:\\ \;\;\;\;\frac{\mathsf{fma}\left(y, x, \left(t - a\right) \cdot z\right)}{\mathsf{fma}\left(z, b - y, y\right)}\\ \mathbf{elif}\;z \le 5.683262740857592061612793319368730308938 \cdot 10^{-245}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \le 3.037828184012740772747570495532188522204 \cdot 10^{81}:\\ \;\;\;\;\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 4.087544577176839063520473760807451583614 \cdot 10^{-280}:\\
\;\;\;\;\frac{\mathsf{fma}\left(y, x, \left(t - a\right) \cdot z\right)}{\mathsf{fma}\left(z, b - y, y\right)}\\

\mathbf{elif}\;z \le 5.683262740857592061612793319368730308938 \cdot 10^{-245}:\\
\;\;\;\;x\\

\mathbf{elif}\;z \le 3.037828184012740772747570495532188522204 \cdot 10^{81}:\\
\;\;\;\;\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 r33565933 = x;
        double r33565934 = y;
        double r33565935 = r33565933 * r33565934;
        double r33565936 = z;
        double r33565937 = t;
        double r33565938 = a;
        double r33565939 = r33565937 - r33565938;
        double r33565940 = r33565936 * r33565939;
        double r33565941 = r33565935 + r33565940;
        double r33565942 = b;
        double r33565943 = r33565942 - r33565934;
        double r33565944 = r33565936 * r33565943;
        double r33565945 = r33565934 + r33565944;
        double r33565946 = r33565941 / r33565945;
        return r33565946;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r33565947 = z;
        double r33565948 = 4.087544577176839e-280;
        bool r33565949 = r33565947 <= r33565948;
        double r33565950 = y;
        double r33565951 = x;
        double r33565952 = t;
        double r33565953 = a;
        double r33565954 = r33565952 - r33565953;
        double r33565955 = r33565954 * r33565947;
        double r33565956 = fma(r33565950, r33565951, r33565955);
        double r33565957 = b;
        double r33565958 = r33565957 - r33565950;
        double r33565959 = fma(r33565947, r33565958, r33565950);
        double r33565960 = r33565956 / r33565959;
        double r33565961 = 5.683262740857592e-245;
        bool r33565962 = r33565947 <= r33565961;
        double r33565963 = 3.0378281840127408e+81;
        bool r33565964 = r33565947 <= r33565963;
        double r33565965 = r33565952 / r33565957;
        double r33565966 = r33565953 / r33565957;
        double r33565967 = r33565965 - r33565966;
        double r33565968 = r33565964 ? r33565960 : r33565967;
        double r33565969 = r33565962 ? r33565951 : r33565968;
        double r33565970 = r33565949 ? r33565960 : r33565969;
        return r33565970;
}

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

Original24.0
Target18.5
Herbie22.2
\[\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 z < 4.087544577176839e-280 or 5.683262740857592e-245 < z < 3.0378281840127408e+81

    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 4.087544577176839e-280 < z < 5.683262740857592e-245

    1. Initial program 10.3

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

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

      \[\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 0 21.8

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

    if 3.0378281840127408e+81 < z

    1. Initial program 45.9

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

      \[\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-num45.9

      \[\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 34.7

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le 4.087544577176839063520473760807451583614 \cdot 10^{-280}:\\ \;\;\;\;\frac{\mathsf{fma}\left(y, x, \left(t - a\right) \cdot z\right)}{\mathsf{fma}\left(z, b - y, y\right)}\\ \mathbf{elif}\;z \le 5.683262740857592061612793319368730308938 \cdot 10^{-245}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \le 3.037828184012740772747570495532188522204 \cdot 10^{81}:\\ \;\;\;\;\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 2019174 +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)))))