Average Error: 22.8 → 20.8
Time: 16.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 -2.90672715700469674 \cdot 10^{170}:\\ \;\;\;\;\frac{t}{b} - \frac{a}{b}\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(x, y, z \cdot \left(t - a\right)\right)}{\mathsf{fma}\left(z, b - y, y\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 -2.90672715700469674 \cdot 10^{170}:\\
\;\;\;\;\frac{t}{b} - \frac{a}{b}\\

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

\end{array}
double f(double x, double y, double z, double t, double a, double b) {
        double r752614 = x;
        double r752615 = y;
        double r752616 = r752614 * r752615;
        double r752617 = z;
        double r752618 = t;
        double r752619 = a;
        double r752620 = r752618 - r752619;
        double r752621 = r752617 * r752620;
        double r752622 = r752616 + r752621;
        double r752623 = b;
        double r752624 = r752623 - r752615;
        double r752625 = r752617 * r752624;
        double r752626 = r752615 + r752625;
        double r752627 = r752622 / r752626;
        return r752627;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r752628 = z;
        double r752629 = -2.906727157004697e+170;
        bool r752630 = r752628 <= r752629;
        double r752631 = t;
        double r752632 = b;
        double r752633 = r752631 / r752632;
        double r752634 = a;
        double r752635 = r752634 / r752632;
        double r752636 = r752633 - r752635;
        double r752637 = x;
        double r752638 = y;
        double r752639 = r752631 - r752634;
        double r752640 = r752628 * r752639;
        double r752641 = fma(r752637, r752638, r752640);
        double r752642 = r752632 - r752638;
        double r752643 = fma(r752628, r752642, r752638);
        double r752644 = r752641 / r752643;
        double r752645 = r752630 ? r752636 : r752644;
        return r752645;
}

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.8
Target17.5
Herbie20.8
\[\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 < -2.906727157004697e+170

    1. Initial program 50.9

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

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

      \[\leadsto \color{blue}{\frac{1}{\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 inf 32.2

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

    if -2.906727157004697e+170 < z

    1. Initial program 19.5

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

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

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

Reproduce

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