Average Error: 23.5 → 22.5
Time: 7.0s
Precision: 64
\[\frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)}\]
\[\begin{array}{l} \mathbf{if}\;y \le -2.6432066037294339 \cdot 10^{207}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \le 5.25582067253227455 \cdot 10^{176}:\\ \;\;\;\;\frac{1}{\mathsf{fma}\left(z, b - y, y\right)} \cdot \mathsf{fma}\left(x, y, z \cdot \left(t - a\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array}\]
\frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)}
\begin{array}{l}
\mathbf{if}\;y \le -2.6432066037294339 \cdot 10^{207}:\\
\;\;\;\;x\\

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

\mathbf{else}:\\
\;\;\;\;x\\

\end{array}
double f(double x, double y, double z, double t, double a, double b) {
        double r1084904 = x;
        double r1084905 = y;
        double r1084906 = r1084904 * r1084905;
        double r1084907 = z;
        double r1084908 = t;
        double r1084909 = a;
        double r1084910 = r1084908 - r1084909;
        double r1084911 = r1084907 * r1084910;
        double r1084912 = r1084906 + r1084911;
        double r1084913 = b;
        double r1084914 = r1084913 - r1084905;
        double r1084915 = r1084907 * r1084914;
        double r1084916 = r1084905 + r1084915;
        double r1084917 = r1084912 / r1084916;
        return r1084917;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r1084918 = y;
        double r1084919 = -2.643206603729434e+207;
        bool r1084920 = r1084918 <= r1084919;
        double r1084921 = x;
        double r1084922 = 5.255820672532275e+176;
        bool r1084923 = r1084918 <= r1084922;
        double r1084924 = 1.0;
        double r1084925 = z;
        double r1084926 = b;
        double r1084927 = r1084926 - r1084918;
        double r1084928 = fma(r1084925, r1084927, r1084918);
        double r1084929 = r1084924 / r1084928;
        double r1084930 = t;
        double r1084931 = a;
        double r1084932 = r1084930 - r1084931;
        double r1084933 = r1084925 * r1084932;
        double r1084934 = fma(r1084921, r1084918, r1084933);
        double r1084935 = r1084929 * r1084934;
        double r1084936 = r1084923 ? r1084935 : r1084921;
        double r1084937 = r1084920 ? r1084921 : r1084936;
        return r1084937;
}

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.5
Target18.5
Herbie22.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 2 regimes
  2. if y < -2.643206603729434e+207 or 5.255820672532275e+176 < y

    1. Initial program 40.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-num40.7

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

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

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

    if -2.643206603729434e+207 < y < 5.255820672532275e+176

    1. Initial program 19.1

      \[\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.2

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

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

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

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

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

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

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

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

Reproduce

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