Average Error: 23.5 → 19.0
Time: 22.9s
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 -9.923599219144975076369968189042099570168 \cdot 10^{68} \lor \neg \left(z \le 3.321856724873589224102758819004170391945 \cdot 10^{116}\right):\\ \;\;\;\;\frac{t}{b} - \frac{a}{b}\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(x, y, z \cdot t + z \cdot \left(-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 -9.923599219144975076369968189042099570168 \cdot 10^{68} \lor \neg \left(z \le 3.321856724873589224102758819004170391945 \cdot 10^{116}\right):\\
\;\;\;\;\frac{t}{b} - \frac{a}{b}\\

\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x, y, z \cdot t + z \cdot \left(-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 r454709 = x;
        double r454710 = y;
        double r454711 = r454709 * r454710;
        double r454712 = z;
        double r454713 = t;
        double r454714 = a;
        double r454715 = r454713 - r454714;
        double r454716 = r454712 * r454715;
        double r454717 = r454711 + r454716;
        double r454718 = b;
        double r454719 = r454718 - r454710;
        double r454720 = r454712 * r454719;
        double r454721 = r454710 + r454720;
        double r454722 = r454717 / r454721;
        return r454722;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r454723 = z;
        double r454724 = -9.923599219144975e+68;
        bool r454725 = r454723 <= r454724;
        double r454726 = 3.321856724873589e+116;
        bool r454727 = r454723 <= r454726;
        double r454728 = !r454727;
        bool r454729 = r454725 || r454728;
        double r454730 = t;
        double r454731 = b;
        double r454732 = r454730 / r454731;
        double r454733 = a;
        double r454734 = r454733 / r454731;
        double r454735 = r454732 - r454734;
        double r454736 = x;
        double r454737 = y;
        double r454738 = r454723 * r454730;
        double r454739 = -r454733;
        double r454740 = r454723 * r454739;
        double r454741 = r454738 + r454740;
        double r454742 = fma(r454736, r454737, r454741);
        double r454743 = r454731 - r454737;
        double r454744 = fma(r454723, r454743, r454737);
        double r454745 = r454742 / r454744;
        double r454746 = r454729 ? r454735 : r454745;
        return r454746;
}

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.3
Herbie19.0
\[\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 < -9.923599219144975e+68 or 3.321856724873589e+116 < z

    1. Initial program 46.4

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

      \[\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-num46.4

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

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

    if -9.923599219144975e+68 < z < 3.321856724873589e+116

    1. Initial program 11.4

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

      \[\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 sub-neg11.4

      \[\leadsto \frac{\mathsf{fma}\left(x, y, z \cdot \color{blue}{\left(t + \left(-a\right)\right)}\right)}{\mathsf{fma}\left(z, b - y, y\right)}\]
    5. Applied distribute-lft-in11.4

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

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

Reproduce

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