Average Error: 22.4 → 19.8
Time: 29.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}\;z \le -7.79363361577941 \cdot 10^{-233}:\\ \;\;\;\;\left(y \cdot x\right) \cdot \frac{1}{\mathsf{fma}\left(b - y, z, y\right)} + \left(t - a\right) \cdot \frac{z}{\mathsf{fma}\left(b - y, z, y\right)}\\ \mathbf{elif}\;z \le 6.721570574179068 \cdot 10^{-285}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \le 2.3187126403961105 \cdot 10^{+207}:\\ \;\;\;\;\left(y \cdot x\right) \cdot \frac{1}{\mathsf{fma}\left(b - y, z, y\right)} + \left(t - a\right) \cdot \frac{z}{\mathsf{fma}\left(b - y, z, y\right)}\\ \mathbf{elif}\;z \le 1.854921660081858 \cdot 10^{+284}:\\ \;\;\;\;\frac{t}{b} - \frac{a}{b}\\ \mathbf{else}:\\ \;\;\;\;\left(y \cdot x\right) \cdot \frac{1}{\mathsf{fma}\left(b - y, z, y\right)} + \left(t - a\right) \cdot \frac{z}{\mathsf{fma}\left(b - y, z, 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 -7.79363361577941 \cdot 10^{-233}:\\
\;\;\;\;\left(y \cdot x\right) \cdot \frac{1}{\mathsf{fma}\left(b - y, z, y\right)} + \left(t - a\right) \cdot \frac{z}{\mathsf{fma}\left(b - y, z, y\right)}\\

\mathbf{elif}\;z \le 6.721570574179068 \cdot 10^{-285}:\\
\;\;\;\;x\\

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

\mathbf{elif}\;z \le 1.854921660081858 \cdot 10^{+284}:\\
\;\;\;\;\frac{t}{b} - \frac{a}{b}\\

\mathbf{else}:\\
\;\;\;\;\left(y \cdot x\right) \cdot \frac{1}{\mathsf{fma}\left(b - y, z, y\right)} + \left(t - a\right) \cdot \frac{z}{\mathsf{fma}\left(b - y, z, y\right)}\\

\end{array}
double f(double x, double y, double z, double t, double a, double b) {
        double r31994223 = x;
        double r31994224 = y;
        double r31994225 = r31994223 * r31994224;
        double r31994226 = z;
        double r31994227 = t;
        double r31994228 = a;
        double r31994229 = r31994227 - r31994228;
        double r31994230 = r31994226 * r31994229;
        double r31994231 = r31994225 + r31994230;
        double r31994232 = b;
        double r31994233 = r31994232 - r31994224;
        double r31994234 = r31994226 * r31994233;
        double r31994235 = r31994224 + r31994234;
        double r31994236 = r31994231 / r31994235;
        return r31994236;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r31994237 = z;
        double r31994238 = -7.79363361577941e-233;
        bool r31994239 = r31994237 <= r31994238;
        double r31994240 = y;
        double r31994241 = x;
        double r31994242 = r31994240 * r31994241;
        double r31994243 = 1.0;
        double r31994244 = b;
        double r31994245 = r31994244 - r31994240;
        double r31994246 = fma(r31994245, r31994237, r31994240);
        double r31994247 = r31994243 / r31994246;
        double r31994248 = r31994242 * r31994247;
        double r31994249 = t;
        double r31994250 = a;
        double r31994251 = r31994249 - r31994250;
        double r31994252 = r31994237 / r31994246;
        double r31994253 = r31994251 * r31994252;
        double r31994254 = r31994248 + r31994253;
        double r31994255 = 6.721570574179068e-285;
        bool r31994256 = r31994237 <= r31994255;
        double r31994257 = 2.3187126403961105e+207;
        bool r31994258 = r31994237 <= r31994257;
        double r31994259 = 1.854921660081858e+284;
        bool r31994260 = r31994237 <= r31994259;
        double r31994261 = r31994249 / r31994244;
        double r31994262 = r31994250 / r31994244;
        double r31994263 = r31994261 - r31994262;
        double r31994264 = r31994260 ? r31994263 : r31994254;
        double r31994265 = r31994258 ? r31994254 : r31994264;
        double r31994266 = r31994256 ? r31994241 : r31994265;
        double r31994267 = r31994239 ? r31994254 : r31994266;
        return r31994267;
}

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.4
Target17.5
Herbie19.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 3 regimes
  2. if z < -7.79363361577941e-233 or 6.721570574179068e-285 < z < 2.3187126403961105e+207 or 1.854921660081858e+284 < z

    1. Initial program 21.8

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

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

      \[\leadsto \frac{1}{\color{blue}{\frac{\mathsf{fma}\left(b - y, z, y\right)}{\mathsf{fma}\left(y, x, z \cdot \left(t - a\right)\right)}}}\]
    5. Using strategy rm
    6. Applied associate-/r/21.9

      \[\leadsto \color{blue}{\frac{1}{\mathsf{fma}\left(b - y, z, y\right)} \cdot \mathsf{fma}\left(y, x, z \cdot \left(t - a\right)\right)}\]
    7. Using strategy rm
    8. Applied add-cube-cbrt22.2

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

      \[\leadsto \frac{1}{\mathsf{fma}\left(b - y, z, y\right)} \cdot \mathsf{fma}\left(y, x, \color{blue}{\left(z \cdot \left(\sqrt[3]{t - a} \cdot \sqrt[3]{t - a}\right)\right) \cdot \sqrt[3]{t - a}}\right)\]
    10. Using strategy rm
    11. Applied fma-udef22.2

      \[\leadsto \frac{1}{\mathsf{fma}\left(b - y, z, y\right)} \cdot \color{blue}{\left(y \cdot x + \left(z \cdot \left(\sqrt[3]{t - a} \cdot \sqrt[3]{t - a}\right)\right) \cdot \sqrt[3]{t - a}\right)}\]
    12. Applied distribute-rgt-in22.2

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

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

    if -7.79363361577941e-233 < z < 6.721570574179068e-285

    1. Initial program 8.1

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

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

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

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

    if 2.3187126403961105e+207 < z < 1.854921660081858e+284

    1. Initial program 50.4

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le -7.79363361577941 \cdot 10^{-233}:\\ \;\;\;\;\left(y \cdot x\right) \cdot \frac{1}{\mathsf{fma}\left(b - y, z, y\right)} + \left(t - a\right) \cdot \frac{z}{\mathsf{fma}\left(b - y, z, y\right)}\\ \mathbf{elif}\;z \le 6.721570574179068 \cdot 10^{-285}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \le 2.3187126403961105 \cdot 10^{+207}:\\ \;\;\;\;\left(y \cdot x\right) \cdot \frac{1}{\mathsf{fma}\left(b - y, z, y\right)} + \left(t - a\right) \cdot \frac{z}{\mathsf{fma}\left(b - y, z, y\right)}\\ \mathbf{elif}\;z \le 1.854921660081858 \cdot 10^{+284}:\\ \;\;\;\;\frac{t}{b} - \frac{a}{b}\\ \mathbf{else}:\\ \;\;\;\;\left(y \cdot x\right) \cdot \frac{1}{\mathsf{fma}\left(b - y, z, y\right)} + \left(t - a\right) \cdot \frac{z}{\mathsf{fma}\left(b - y, z, y\right)}\\ \end{array}\]

Reproduce

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