Average Error: 22.2 → 21.4
Time: 21.9s
Precision: 64
\[\frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)}\]
\[\begin{array}{l} \mathbf{if}\;y \le -8.035727998527714617419339155309373680067 \cdot 10^{176}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \le 3.485182784660639273347963075569006005529 \cdot 10^{169}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\left(-a\right) + a, z, \mathsf{fma}\left(t - a, z, x \cdot y\right)\right)}{\mathsf{fma}\left(b - y, z, y\right)}\\ \mathbf{elif}\;y \le 8.0565165037956236442450787677800250955 \cdot 10^{298}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;\left(\mathsf{fma}\left(t - a, z, x \cdot y\right) + z \cdot \mathsf{fma}\left(-a, 1, a\right)\right) \cdot \left(\left(\sqrt[3]{\frac{1}{\mathsf{fma}\left(b - y, z, y\right)}} \cdot \sqrt[3]{\frac{1}{\mathsf{fma}\left(b - y, z, y\right)}}\right) \cdot \sqrt[3]{\frac{1}{\mathsf{fma}\left(b - y, z, y\right)}}\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}\;y \le -8.035727998527714617419339155309373680067 \cdot 10^{176}:\\
\;\;\;\;x\\

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

\mathbf{elif}\;y \le 8.0565165037956236442450787677800250955 \cdot 10^{298}:\\
\;\;\;\;x\\

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

\end{array}
double f(double x, double y, double z, double t, double a, double b) {
        double r598131 = x;
        double r598132 = y;
        double r598133 = r598131 * r598132;
        double r598134 = z;
        double r598135 = t;
        double r598136 = a;
        double r598137 = r598135 - r598136;
        double r598138 = r598134 * r598137;
        double r598139 = r598133 + r598138;
        double r598140 = b;
        double r598141 = r598140 - r598132;
        double r598142 = r598134 * r598141;
        double r598143 = r598132 + r598142;
        double r598144 = r598139 / r598143;
        return r598144;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r598145 = y;
        double r598146 = -8.035727998527715e+176;
        bool r598147 = r598145 <= r598146;
        double r598148 = x;
        double r598149 = 3.485182784660639e+169;
        bool r598150 = r598145 <= r598149;
        double r598151 = a;
        double r598152 = -r598151;
        double r598153 = r598152 + r598151;
        double r598154 = z;
        double r598155 = t;
        double r598156 = r598155 - r598151;
        double r598157 = r598148 * r598145;
        double r598158 = fma(r598156, r598154, r598157);
        double r598159 = fma(r598153, r598154, r598158);
        double r598160 = b;
        double r598161 = r598160 - r598145;
        double r598162 = fma(r598161, r598154, r598145);
        double r598163 = r598159 / r598162;
        double r598164 = 8.056516503795624e+298;
        bool r598165 = r598145 <= r598164;
        double r598166 = 1.0;
        double r598167 = fma(r598152, r598166, r598151);
        double r598168 = r598154 * r598167;
        double r598169 = r598158 + r598168;
        double r598170 = r598166 / r598162;
        double r598171 = cbrt(r598170);
        double r598172 = r598171 * r598171;
        double r598173 = r598172 * r598171;
        double r598174 = r598169 * r598173;
        double r598175 = r598165 ? r598148 : r598174;
        double r598176 = r598150 ? r598163 : r598175;
        double r598177 = r598147 ? r598148 : r598176;
        return r598177;
}

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.2
Target17.1
Herbie21.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 3 regimes
  2. if y < -8.035727998527715e+176 or 3.485182784660639e+169 < y < 8.056516503795624e+298

    1. Initial program 38.8

      \[\frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)}\]
    2. Using strategy rm
    3. Applied *-un-lft-identity38.8

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

      \[\leadsto \frac{x \cdot y + z \cdot \left(\color{blue}{\sqrt{t} \cdot \sqrt{t}} - 1 \cdot a\right)}{y + z \cdot \left(b - y\right)}\]
    5. Applied prod-diff50.3

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

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

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

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

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

    if -8.035727998527715e+176 < y < 3.485182784660639e+169

    1. Initial program 17.4

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

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

      \[\leadsto \frac{x \cdot y + z \cdot \left(\color{blue}{\sqrt{t} \cdot \sqrt{t}} - 1 \cdot a\right)}{y + z \cdot \left(b - y\right)}\]
    5. Applied prod-diff40.6

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

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

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

      \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(t - a, z, x \cdot y\right)} + z \cdot \mathsf{fma}\left(-a, 1, a \cdot 1\right)}{y + z \cdot \left(b - y\right)}\]
    9. Using strategy rm
    10. Applied div-inv17.5

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

      \[\leadsto \left(\mathsf{fma}\left(t - a, z, x \cdot y\right) + z \cdot \mathsf{fma}\left(-a, 1, a \cdot 1\right)\right) \cdot \color{blue}{\frac{1}{\mathsf{fma}\left(b - y, z, y\right)}}\]
    12. Using strategy rm
    13. Applied *-un-lft-identity17.5

      \[\leadsto \color{blue}{\left(1 \cdot \left(\mathsf{fma}\left(t - a, z, x \cdot y\right) + z \cdot \mathsf{fma}\left(-a, 1, a \cdot 1\right)\right)\right)} \cdot \frac{1}{\mathsf{fma}\left(b - y, z, y\right)}\]
    14. Applied associate-*l*17.5

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

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

    if 8.056516503795624e+298 < y

    1. Initial program 45.5

      \[\frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)}\]
    2. Using strategy rm
    3. Applied *-un-lft-identity45.5

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

      \[\leadsto \frac{x \cdot y + z \cdot \left(\color{blue}{\sqrt{t} \cdot \sqrt{t}} - 1 \cdot a\right)}{y + z \cdot \left(b - y\right)}\]
    5. Applied prod-diff55.5

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

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

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

      \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(t - a, z, x \cdot y\right)} + z \cdot \mathsf{fma}\left(-a, 1, a \cdot 1\right)}{y + z \cdot \left(b - y\right)}\]
    9. Using strategy rm
    10. Applied div-inv45.5

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \le -8.035727998527714617419339155309373680067 \cdot 10^{176}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \le 3.485182784660639273347963075569006005529 \cdot 10^{169}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\left(-a\right) + a, z, \mathsf{fma}\left(t - a, z, x \cdot y\right)\right)}{\mathsf{fma}\left(b - y, z, y\right)}\\ \mathbf{elif}\;y \le 8.0565165037956236442450787677800250955 \cdot 10^{298}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;\left(\mathsf{fma}\left(t - a, z, x \cdot y\right) + z \cdot \mathsf{fma}\left(-a, 1, a\right)\right) \cdot \left(\left(\sqrt[3]{\frac{1}{\mathsf{fma}\left(b - y, z, y\right)}} \cdot \sqrt[3]{\frac{1}{\mathsf{fma}\left(b - y, z, y\right)}}\right) \cdot \sqrt[3]{\frac{1}{\mathsf{fma}\left(b - y, z, y\right)}}\right)\\ \end{array}\]

Reproduce

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