Average Error: 23.3 → 19.2
Time: 19.2s
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.62529910386796021 \cdot 10^{132} \lor \neg \left(z \le 1.3201406329171877 \cdot 10^{89}\right):\\ \;\;\;\;\frac{t}{b} - \frac{a}{b}\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(x, y, \left(t - a\right) \cdot z\right)}{z \cdot \left(b - y\right) + y}\\ \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.62529910386796021 \cdot 10^{132} \lor \neg \left(z \le 1.3201406329171877 \cdot 10^{89}\right):\\
\;\;\;\;\frac{t}{b} - \frac{a}{b}\\

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

\end{array}
double f(double x, double y, double z, double t, double a, double b) {
        double r556514 = x;
        double r556515 = y;
        double r556516 = r556514 * r556515;
        double r556517 = z;
        double r556518 = t;
        double r556519 = a;
        double r556520 = r556518 - r556519;
        double r556521 = r556517 * r556520;
        double r556522 = r556516 + r556521;
        double r556523 = b;
        double r556524 = r556523 - r556515;
        double r556525 = r556517 * r556524;
        double r556526 = r556515 + r556525;
        double r556527 = r556522 / r556526;
        return r556527;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r556528 = z;
        double r556529 = -4.62529910386796e+132;
        bool r556530 = r556528 <= r556529;
        double r556531 = 1.3201406329171877e+89;
        bool r556532 = r556528 <= r556531;
        double r556533 = !r556532;
        bool r556534 = r556530 || r556533;
        double r556535 = t;
        double r556536 = b;
        double r556537 = r556535 / r556536;
        double r556538 = a;
        double r556539 = r556538 / r556536;
        double r556540 = r556537 - r556539;
        double r556541 = x;
        double r556542 = y;
        double r556543 = r556535 - r556538;
        double r556544 = r556543 * r556528;
        double r556545 = fma(r556541, r556542, r556544);
        double r556546 = r556536 - r556542;
        double r556547 = r556528 * r556546;
        double r556548 = r556547 + r556542;
        double r556549 = r556545 / r556548;
        double r556550 = r556534 ? r556540 : r556549;
        return r556550;
}

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.3
Target18.1
Herbie19.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 2 regimes
  2. if z < -4.62529910386796e+132 or 1.3201406329171877e+89 < z

    1. Initial program 47.2

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

      \[\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-num47.3

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

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

    if -4.62529910386796e+132 < z < 1.3201406329171877e+89

    1. Initial program 12.4

      \[\frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)}\]
    2. Simplified12.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-num12.5

      \[\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. Using strategy rm
    6. Applied add-cube-cbrt12.5

      \[\leadsto \frac{\color{blue}{\left(\sqrt[3]{1} \cdot \sqrt[3]{1}\right) \cdot \sqrt[3]{1}}}{\frac{\mathsf{fma}\left(z, b - y, y\right)}{\mathsf{fma}\left(x, y, z \cdot \left(t - a\right)\right)}}\]
    7. Applied associate-/l*12.5

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

      \[\leadsto \frac{\sqrt[3]{1} \cdot \sqrt[3]{1}}{\color{blue}{\frac{\mathsf{fma}\left(z, b - y, y\right)}{\mathsf{fma}\left(z, t - a, x \cdot y\right)}}}\]
    9. Using strategy rm
    10. Applied *-un-lft-identity12.5

      \[\leadsto \frac{\sqrt[3]{1} \cdot \sqrt[3]{1}}{\frac{\mathsf{fma}\left(z, b - y, y\right)}{\color{blue}{1 \cdot \mathsf{fma}\left(z, t - a, x \cdot y\right)}}}\]
    11. Applied *-un-lft-identity12.5

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

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

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

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

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

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

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

Reproduce

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