Average Error: 23.6 → 19.6
Time: 7.5s
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 -3.1767387049505709 \cdot 10^{91}:\\ \;\;\;\;\frac{t}{b} - \frac{a}{b}\\ \mathbf{elif}\;z \le 3.5521863173674646 \cdot 10^{112}:\\ \;\;\;\;\frac{1}{\frac{\mathsf{fma}\left(z, b - y, y\right)}{\mathsf{fma}\left(x, y, z \cdot \left(t - a\right)\right)}}\\ \mathbf{elif}\;z \le 2.52165756346823545 \cdot 10^{288}:\\ \;\;\;\;\frac{t}{b} - \frac{a}{b}\\ \mathbf{else}:\\ \;\;\;\;\frac{a}{y} - \left(\frac{t}{y} + \frac{x}{z}\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 -3.1767387049505709 \cdot 10^{91}:\\
\;\;\;\;\frac{t}{b} - \frac{a}{b}\\

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

\mathbf{elif}\;z \le 2.52165756346823545 \cdot 10^{288}:\\
\;\;\;\;\frac{t}{b} - \frac{a}{b}\\

\mathbf{else}:\\
\;\;\;\;\frac{a}{y} - \left(\frac{t}{y} + \frac{x}{z}\right)\\

\end{array}
double f(double x, double y, double z, double t, double a, double b) {
        double r677730 = x;
        double r677731 = y;
        double r677732 = r677730 * r677731;
        double r677733 = z;
        double r677734 = t;
        double r677735 = a;
        double r677736 = r677734 - r677735;
        double r677737 = r677733 * r677736;
        double r677738 = r677732 + r677737;
        double r677739 = b;
        double r677740 = r677739 - r677731;
        double r677741 = r677733 * r677740;
        double r677742 = r677731 + r677741;
        double r677743 = r677738 / r677742;
        return r677743;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r677744 = z;
        double r677745 = -3.176738704950571e+91;
        bool r677746 = r677744 <= r677745;
        double r677747 = t;
        double r677748 = b;
        double r677749 = r677747 / r677748;
        double r677750 = a;
        double r677751 = r677750 / r677748;
        double r677752 = r677749 - r677751;
        double r677753 = 3.5521863173674646e+112;
        bool r677754 = r677744 <= r677753;
        double r677755 = 1.0;
        double r677756 = y;
        double r677757 = r677748 - r677756;
        double r677758 = fma(r677744, r677757, r677756);
        double r677759 = x;
        double r677760 = r677747 - r677750;
        double r677761 = r677744 * r677760;
        double r677762 = fma(r677759, r677756, r677761);
        double r677763 = r677758 / r677762;
        double r677764 = r677755 / r677763;
        double r677765 = 2.5216575634682354e+288;
        bool r677766 = r677744 <= r677765;
        double r677767 = r677750 / r677756;
        double r677768 = r677747 / r677756;
        double r677769 = r677759 / r677744;
        double r677770 = r677768 + r677769;
        double r677771 = r677767 - r677770;
        double r677772 = r677766 ? r677752 : r677771;
        double r677773 = r677754 ? r677764 : r677772;
        double r677774 = r677746 ? r677752 : r677773;
        return r677774;
}

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.6
Target18.1
Herbie19.6
\[\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 3 regimes
  2. if z < -3.176738704950571e+91 or 3.5521863173674646e+112 < z < 2.5216575634682354e+288

    1. Initial program 45.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-num45.7

      \[\leadsto \color{blue}{\frac{1}{\frac{y + z \cdot \left(b - y\right)}{x \cdot y + z \cdot \left(t - a\right)}}}\]
    4. Simplified45.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 inf 34.1

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

    if -3.176738704950571e+91 < z < 3.5521863173674646e+112

    1. Initial program 12.2

      \[\frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)}\]
    2. Using strategy rm
    3. Applied clear-num12.4

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

      \[\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)}}}\]

    if 2.5216575634682354e+288 < z

    1. Initial program 55.0

      \[\frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)}\]
    2. Using strategy rm
    3. Applied *-un-lft-identity55.0

      \[\leadsto \frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - \color{blue}{1 \cdot y}\right)}\]
    4. Applied add-cube-cbrt55.0

      \[\leadsto \frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(\color{blue}{\left(\sqrt[3]{b} \cdot \sqrt[3]{b}\right) \cdot \sqrt[3]{b}} - 1 \cdot y\right)}\]
    5. Applied prod-diff55.0

      \[\leadsto \frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \color{blue}{\left(\mathsf{fma}\left(\sqrt[3]{b} \cdot \sqrt[3]{b}, \sqrt[3]{b}, -y \cdot 1\right) + \mathsf{fma}\left(-y, 1, y \cdot 1\right)\right)}}\]
    6. Applied distribute-rgt-in55.0

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

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

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

      \[\leadsto \color{blue}{\frac{a}{y} - \left(\frac{t}{y} + \frac{x}{z}\right)}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification19.6

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le -3.1767387049505709 \cdot 10^{91}:\\ \;\;\;\;\frac{t}{b} - \frac{a}{b}\\ \mathbf{elif}\;z \le 3.5521863173674646 \cdot 10^{112}:\\ \;\;\;\;\frac{1}{\frac{\mathsf{fma}\left(z, b - y, y\right)}{\mathsf{fma}\left(x, y, z \cdot \left(t - a\right)\right)}}\\ \mathbf{elif}\;z \le 2.52165756346823545 \cdot 10^{288}:\\ \;\;\;\;\frac{t}{b} - \frac{a}{b}\\ \mathbf{else}:\\ \;\;\;\;\frac{a}{y} - \left(\frac{t}{y} + \frac{x}{z}\right)\\ \end{array}\]

Reproduce

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