Average Error: 23.2 → 20.1
Time: 7.3s
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.2825952014482863 \cdot 10^{70} \lor \neg \left(z \le 3.6434322402537893 \cdot 10^{46}\right):\\ \;\;\;\;\frac{t}{b} - \frac{a}{b}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\mathsf{fma}\left(z, b - y, y\right)} \cdot \left(x \cdot y + z \cdot \left(t - a\right)\right)\\ \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.2825952014482863 \cdot 10^{70} \lor \neg \left(z \le 3.6434322402537893 \cdot 10^{46}\right):\\
\;\;\;\;\frac{t}{b} - \frac{a}{b}\\

\mathbf{else}:\\
\;\;\;\;\frac{1}{\mathsf{fma}\left(z, b - y, y\right)} \cdot \left(x \cdot y + z \cdot \left(t - a\right)\right)\\

\end{array}
double f(double x, double y, double z, double t, double a, double b) {
        double r910220 = x;
        double r910221 = y;
        double r910222 = r910220 * r910221;
        double r910223 = z;
        double r910224 = t;
        double r910225 = a;
        double r910226 = r910224 - r910225;
        double r910227 = r910223 * r910226;
        double r910228 = r910222 + r910227;
        double r910229 = b;
        double r910230 = r910229 - r910221;
        double r910231 = r910223 * r910230;
        double r910232 = r910221 + r910231;
        double r910233 = r910228 / r910232;
        return r910233;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r910234 = z;
        double r910235 = -4.2825952014482863e+70;
        bool r910236 = r910234 <= r910235;
        double r910237 = 3.6434322402537893e+46;
        bool r910238 = r910234 <= r910237;
        double r910239 = !r910238;
        bool r910240 = r910236 || r910239;
        double r910241 = t;
        double r910242 = b;
        double r910243 = r910241 / r910242;
        double r910244 = a;
        double r910245 = r910244 / r910242;
        double r910246 = r910243 - r910245;
        double r910247 = 1.0;
        double r910248 = y;
        double r910249 = r910242 - r910248;
        double r910250 = fma(r910234, r910249, r910248);
        double r910251 = r910247 / r910250;
        double r910252 = x;
        double r910253 = r910252 * r910248;
        double r910254 = r910241 - r910244;
        double r910255 = r910234 * r910254;
        double r910256 = r910253 + r910255;
        double r910257 = r910251 * r910256;
        double r910258 = r910240 ? r910246 : r910257;
        return r910258;
}

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.2
Target18.2
Herbie20.1
\[\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 < -4.2825952014482863e+70 or 3.6434322402537893e+46 < z

    1. Initial program 43.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-num43.4

      \[\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 associate-/r/43.3

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

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

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

    if -4.2825952014482863e+70 < z < 3.6434322402537893e+46

    1. Initial program 10.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-num10.4

      \[\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 associate-/r/10.4

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le -4.2825952014482863 \cdot 10^{70} \lor \neg \left(z \le 3.6434322402537893 \cdot 10^{46}\right):\\ \;\;\;\;\frac{t}{b} - \frac{a}{b}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\mathsf{fma}\left(z, b - y, y\right)} \cdot \left(x \cdot y + z \cdot \left(t - a\right)\right)\\ \end{array}\]

Reproduce

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