Average Error: 22.8 → 20.8
Time: 15.3s
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 -2.90672715700469674 \cdot 10^{170}:\\ \;\;\;\;\frac{t}{b} - \frac{a}{b}\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(x, y, z \cdot \left(t - 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 -2.90672715700469674 \cdot 10^{170}:\\
\;\;\;\;\frac{t}{b} - \frac{a}{b}\\

\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x, y, z \cdot \left(t - 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 r856948 = x;
        double r856949 = y;
        double r856950 = r856948 * r856949;
        double r856951 = z;
        double r856952 = t;
        double r856953 = a;
        double r856954 = r856952 - r856953;
        double r856955 = r856951 * r856954;
        double r856956 = r856950 + r856955;
        double r856957 = b;
        double r856958 = r856957 - r856949;
        double r856959 = r856951 * r856958;
        double r856960 = r856949 + r856959;
        double r856961 = r856956 / r856960;
        return r856961;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r856962 = z;
        double r856963 = -2.906727157004697e+170;
        bool r856964 = r856962 <= r856963;
        double r856965 = t;
        double r856966 = b;
        double r856967 = r856965 / r856966;
        double r856968 = a;
        double r856969 = r856968 / r856966;
        double r856970 = r856967 - r856969;
        double r856971 = x;
        double r856972 = y;
        double r856973 = r856965 - r856968;
        double r856974 = r856962 * r856973;
        double r856975 = fma(r856971, r856972, r856974);
        double r856976 = r856966 - r856972;
        double r856977 = fma(r856962, r856976, r856972);
        double r856978 = r856975 / r856977;
        double r856979 = r856964 ? r856970 : r856978;
        return r856979;
}

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

Original22.8
Target17.5
Herbie20.8
\[\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 < -2.906727157004697e+170

    1. Initial program 50.9

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

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

    if -2.906727157004697e+170 < z

    1. Initial program 19.5

      \[\frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)}\]
    2. Simplified19.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. Recombined 2 regimes into one program.
  4. Final simplification20.8

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

Reproduce

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