Average Error: 23.1 → 22.7
Time: 8.0s
Precision: 64
\[\frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)}\]
\[\begin{array}{l} \mathbf{if}\;y \le 3.5234477440446439 \cdot 10^{170}:\\ \;\;\;\;\frac{\mathsf{fma}\left(x, y, z \cdot \left(t - a\right)\right)}{\mathsf{fma}\left(b - y, z, y\right)}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array}\]
\frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)}
\begin{array}{l}
\mathbf{if}\;y \le 3.5234477440446439 \cdot 10^{170}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x, y, z \cdot \left(t - a\right)\right)}{\mathsf{fma}\left(b - y, z, y\right)}\\

\mathbf{else}:\\
\;\;\;\;x\\

\end{array}
double f(double x, double y, double z, double t, double a, double b) {
        double r902004 = x;
        double r902005 = y;
        double r902006 = r902004 * r902005;
        double r902007 = z;
        double r902008 = t;
        double r902009 = a;
        double r902010 = r902008 - r902009;
        double r902011 = r902007 * r902010;
        double r902012 = r902006 + r902011;
        double r902013 = b;
        double r902014 = r902013 - r902005;
        double r902015 = r902007 * r902014;
        double r902016 = r902005 + r902015;
        double r902017 = r902012 / r902016;
        return r902017;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r902018 = y;
        double r902019 = 3.523447744044644e+170;
        bool r902020 = r902018 <= r902019;
        double r902021 = x;
        double r902022 = z;
        double r902023 = t;
        double r902024 = a;
        double r902025 = r902023 - r902024;
        double r902026 = r902022 * r902025;
        double r902027 = fma(r902021, r902018, r902026);
        double r902028 = b;
        double r902029 = r902028 - r902018;
        double r902030 = fma(r902029, r902022, r902018);
        double r902031 = r902027 / r902030;
        double r902032 = r902020 ? r902031 : r902021;
        return r902032;
}

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.1
Target17.9
Herbie22.7
\[\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 y < 3.523447744044644e+170

    1. Initial program 21.0

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

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

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

      \[\leadsto \frac{\color{blue}{\left(\sqrt[3]{1} \cdot \sqrt[3]{1}\right) \cdot \sqrt[3]{1}}}{\left(y + z \cdot \left(b - y\right)\right) \cdot \frac{1}{x \cdot y + z \cdot \left(t - a\right)}}\]
    7. Applied times-frac21.2

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

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

      \[\leadsto \frac{1}{\mathsf{fma}\left(b - y, z, y\right)} \cdot \color{blue}{\mathsf{fma}\left(x, y, z \cdot \left(t - a\right)\right)}\]
    10. Using strategy rm
    11. Applied associate-*l/21.0

      \[\leadsto \color{blue}{\frac{1 \cdot \mathsf{fma}\left(x, y, z \cdot \left(t - a\right)\right)}{\mathsf{fma}\left(b - y, z, y\right)}}\]
    12. Simplified21.0

      \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(x, y, z \cdot \left(t - a\right)\right)}}{\mathsf{fma}\left(b - y, z, y\right)}\]

    if 3.523447744044644e+170 < y

    1. Initial program 38.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-num38.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 div-inv38.4

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

      \[\leadsto \frac{\color{blue}{\left(\sqrt[3]{1} \cdot \sqrt[3]{1}\right) \cdot \sqrt[3]{1}}}{\left(y + z \cdot \left(b - y\right)\right) \cdot \frac{1}{x \cdot y + z \cdot \left(t - a\right)}}\]
    7. Applied times-frac38.4

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

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

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

      \[\leadsto \color{blue}{x}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification22.7

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

Reproduce

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