Average Error: 24.0 → 22.2
Time: 23.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.087544577176839063520473760807451583614 \cdot 10^{-280}:\\ \;\;\;\;\frac{\mathsf{fma}\left(x, y, z \cdot \left(t - a\right)\right)}{\mathsf{fma}\left(z, b - y, y\right)}\\ \mathbf{elif}\;z \le 5.683262740857592061612793319368730308938 \cdot 10^{-245}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \le 3.037828184012740772747570495532188522204 \cdot 10^{81}:\\ \;\;\;\;\frac{\mathsf{fma}\left(x, y, z \cdot \left(t - a\right)\right)}{\mathsf{fma}\left(z, b - y, y\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{t}{b} - \frac{a}{b}\\ \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.087544577176839063520473760807451583614 \cdot 10^{-280}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x, y, z \cdot \left(t - a\right)\right)}{\mathsf{fma}\left(z, b - y, y\right)}\\

\mathbf{elif}\;z \le 5.683262740857592061612793319368730308938 \cdot 10^{-245}:\\
\;\;\;\;x\\

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

\mathbf{else}:\\
\;\;\;\;\frac{t}{b} - \frac{a}{b}\\

\end{array}
double f(double x, double y, double z, double t, double a, double b) {
        double r49727291 = x;
        double r49727292 = y;
        double r49727293 = r49727291 * r49727292;
        double r49727294 = z;
        double r49727295 = t;
        double r49727296 = a;
        double r49727297 = r49727295 - r49727296;
        double r49727298 = r49727294 * r49727297;
        double r49727299 = r49727293 + r49727298;
        double r49727300 = b;
        double r49727301 = r49727300 - r49727292;
        double r49727302 = r49727294 * r49727301;
        double r49727303 = r49727292 + r49727302;
        double r49727304 = r49727299 / r49727303;
        return r49727304;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r49727305 = z;
        double r49727306 = 4.087544577176839e-280;
        bool r49727307 = r49727305 <= r49727306;
        double r49727308 = x;
        double r49727309 = y;
        double r49727310 = t;
        double r49727311 = a;
        double r49727312 = r49727310 - r49727311;
        double r49727313 = r49727305 * r49727312;
        double r49727314 = fma(r49727308, r49727309, r49727313);
        double r49727315 = b;
        double r49727316 = r49727315 - r49727309;
        double r49727317 = fma(r49727305, r49727316, r49727309);
        double r49727318 = r49727314 / r49727317;
        double r49727319 = 5.683262740857592e-245;
        bool r49727320 = r49727305 <= r49727319;
        double r49727321 = 3.0378281840127408e+81;
        bool r49727322 = r49727305 <= r49727321;
        double r49727323 = r49727310 / r49727315;
        double r49727324 = r49727311 / r49727315;
        double r49727325 = r49727323 - r49727324;
        double r49727326 = r49727322 ? r49727318 : r49727325;
        double r49727327 = r49727320 ? r49727308 : r49727326;
        double r49727328 = r49727307 ? r49727318 : r49727327;
        return r49727328;
}

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

Original24.0
Target18.5
Herbie22.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 3 regimes
  2. if z < 4.087544577176839e-280 or 5.683262740857592e-245 < z < 3.0378281840127408e+81

    1. Initial program 19.1

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

    if 4.087544577176839e-280 < z < 5.683262740857592e-245

    1. Initial program 10.3

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

      \[\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-num10.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. Taylor expanded around 0 21.8

      \[\leadsto \color{blue}{x}\]

    if 3.0378281840127408e+81 < z

    1. Initial program 45.9

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

      \[\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-num45.9

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

      \[\leadsto \color{blue}{\frac{t}{b} - \frac{a}{b}}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification22.2

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le 4.087544577176839063520473760807451583614 \cdot 10^{-280}:\\ \;\;\;\;\frac{\mathsf{fma}\left(x, y, z \cdot \left(t - a\right)\right)}{\mathsf{fma}\left(z, b - y, y\right)}\\ \mathbf{elif}\;z \le 5.683262740857592061612793319368730308938 \cdot 10^{-245}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \le 3.037828184012740772747570495532188522204 \cdot 10^{81}:\\ \;\;\;\;\frac{\mathsf{fma}\left(x, y, z \cdot \left(t - a\right)\right)}{\mathsf{fma}\left(z, b - y, y\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{t}{b} - \frac{a}{b}\\ \end{array}\]

Reproduce

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