Average Error: 23.5 → 19.4
Time: 18.7s
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.665038426051912396184031217946615125606 \cdot 10^{124} \lor \neg \left(z \le 1.680173933349986921917841934759009957402 \cdot 10^{105}\right):\\ \;\;\;\;\frac{t}{b} - \frac{a}{b}\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(x, y, z \cdot t + z \cdot \left(-a\right)\right)}{\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.665038426051912396184031217946615125606 \cdot 10^{124} \lor \neg \left(z \le 1.680173933349986921917841934759009957402 \cdot 10^{105}\right):\\
\;\;\;\;\frac{t}{b} - \frac{a}{b}\\

\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x, y, z \cdot t + z \cdot \left(-a\right)\right)}{\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 r612353 = x;
        double r612354 = y;
        double r612355 = r612353 * r612354;
        double r612356 = z;
        double r612357 = t;
        double r612358 = a;
        double r612359 = r612357 - r612358;
        double r612360 = r612356 * r612359;
        double r612361 = r612355 + r612360;
        double r612362 = b;
        double r612363 = r612362 - r612354;
        double r612364 = r612356 * r612363;
        double r612365 = r612354 + r612364;
        double r612366 = r612361 / r612365;
        return r612366;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r612367 = z;
        double r612368 = -1.6650384260519124e+124;
        bool r612369 = r612367 <= r612368;
        double r612370 = 1.680173933349987e+105;
        bool r612371 = r612367 <= r612370;
        double r612372 = !r612371;
        bool r612373 = r612369 || r612372;
        double r612374 = t;
        double r612375 = b;
        double r612376 = r612374 / r612375;
        double r612377 = a;
        double r612378 = r612377 / r612375;
        double r612379 = r612376 - r612378;
        double r612380 = x;
        double r612381 = y;
        double r612382 = r612367 * r612374;
        double r612383 = -r612377;
        double r612384 = r612367 * r612383;
        double r612385 = r612382 + r612384;
        double r612386 = fma(r612380, r612381, r612385);
        double r612387 = r612375 - r612381;
        double r612388 = fma(r612367, r612387, r612381);
        double r612389 = r612386 / r612388;
        double r612390 = r612373 ? r612379 : r612389;
        return r612390;
}

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.5
Target18.3
Herbie19.4
\[\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.6650384260519124e+124 or 1.680173933349987e+105 < z

    1. Initial program 47.3

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

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

    if -1.6650384260519124e+124 < z < 1.680173933349987e+105

    1. Initial program 12.9

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

      \[\leadsto \frac{\mathsf{fma}\left(x, y, z \cdot \color{blue}{\left(t + \left(-a\right)\right)}\right)}{\mathsf{fma}\left(z, b - y, y\right)}\]
    5. Applied distribute-lft-in12.9

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

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

Reproduce

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