Average Error: 23.0 → 19.5
Time: 26.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 -1.500515269701936613142365001329481748126 \cdot 10^{178} \lor \neg \left(z \le 4.440792624921616766981018871848586220207 \cdot 10^{82}\right):\\ \;\;\;\;\frac{t}{b} - \frac{a}{b}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(x, y, z \cdot \left(t - a\right)\right) \cdot \frac{1}{\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 -1.500515269701936613142365001329481748126 \cdot 10^{178} \lor \neg \left(z \le 4.440792624921616766981018871848586220207 \cdot 10^{82}\right):\\
\;\;\;\;\frac{t}{b} - \frac{a}{b}\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x, y, z \cdot \left(t - a\right)\right) \cdot \frac{1}{\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 r473497 = x;
        double r473498 = y;
        double r473499 = r473497 * r473498;
        double r473500 = z;
        double r473501 = t;
        double r473502 = a;
        double r473503 = r473501 - r473502;
        double r473504 = r473500 * r473503;
        double r473505 = r473499 + r473504;
        double r473506 = b;
        double r473507 = r473506 - r473498;
        double r473508 = r473500 * r473507;
        double r473509 = r473498 + r473508;
        double r473510 = r473505 / r473509;
        return r473510;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r473511 = z;
        double r473512 = -1.5005152697019366e+178;
        bool r473513 = r473511 <= r473512;
        double r473514 = 4.440792624921617e+82;
        bool r473515 = r473511 <= r473514;
        double r473516 = !r473515;
        bool r473517 = r473513 || r473516;
        double r473518 = t;
        double r473519 = b;
        double r473520 = r473518 / r473519;
        double r473521 = a;
        double r473522 = r473521 / r473519;
        double r473523 = r473520 - r473522;
        double r473524 = x;
        double r473525 = y;
        double r473526 = r473518 - r473521;
        double r473527 = r473511 * r473526;
        double r473528 = fma(r473524, r473525, r473527);
        double r473529 = 1.0;
        double r473530 = r473519 - r473525;
        double r473531 = fma(r473511, r473530, r473525);
        double r473532 = r473529 / r473531;
        double r473533 = r473528 * r473532;
        double r473534 = r473517 ? r473523 : r473533;
        return r473534;
}

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.0
Target18.0
Herbie19.5
\[\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 < -1.5005152697019366e+178 or 4.440792624921617e+82 < z

    1. Initial program 47.1

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

      \[\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.1

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

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

    if -1.5005152697019366e+178 < z < 4.440792624921617e+82

    1. Initial program 13.5

      \[\frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)}\]
    2. Simplified13.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. Using strategy rm
    4. Applied div-inv13.6

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le -1.500515269701936613142365001329481748126 \cdot 10^{178} \lor \neg \left(z \le 4.440792624921616766981018871848586220207 \cdot 10^{82}\right):\\ \;\;\;\;\frac{t}{b} - \frac{a}{b}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(x, y, z \cdot \left(t - a\right)\right) \cdot \frac{1}{\mathsf{fma}\left(z, b - y, y\right)}\\ \end{array}\]

Reproduce

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