Average Error: 23.0 → 18.6
Time: 22.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}\;z \le -6.665018424556654185786159367392459116065 \cdot 10^{158}:\\ \;\;\;\;\frac{0}{\mathsf{fma}\left(z, b - y, y\right)} - \frac{a}{\left(\frac{y}{z} + b\right) - y}\\ \mathbf{elif}\;z \le -6.978402419817959865349829113622978959547 \cdot 10^{-298}:\\ \;\;\;\;\frac{\mathsf{fma}\left(t, z, x \cdot y\right)}{\mathsf{fma}\left(z, b - y, y\right)} - \frac{1}{\frac{\left(\frac{y}{z} + b\right) - y}{a}}\\ \mathbf{elif}\;z \le 1.405623299971047515023653888156309257696 \cdot 10^{-186}:\\ \;\;\;\;\mathsf{fma}\left(x, z, x\right) - \frac{a}{\left(\frac{y}{z} + b\right) - y}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(t, z, x \cdot y\right) \cdot \frac{1}{\mathsf{fma}\left(z, b - y, y\right)} - \frac{a}{\left(\frac{y}{z} + b\right) - y}\\ \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 -6.665018424556654185786159367392459116065 \cdot 10^{158}:\\
\;\;\;\;\frac{0}{\mathsf{fma}\left(z, b - y, y\right)} - \frac{a}{\left(\frac{y}{z} + b\right) - y}\\

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

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

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

\end{array}
double f(double x, double y, double z, double t, double a, double b) {
        double r476148 = x;
        double r476149 = y;
        double r476150 = r476148 * r476149;
        double r476151 = z;
        double r476152 = t;
        double r476153 = a;
        double r476154 = r476152 - r476153;
        double r476155 = r476151 * r476154;
        double r476156 = r476150 + r476155;
        double r476157 = b;
        double r476158 = r476157 - r476149;
        double r476159 = r476151 * r476158;
        double r476160 = r476149 + r476159;
        double r476161 = r476156 / r476160;
        return r476161;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r476162 = z;
        double r476163 = -6.665018424556654e+158;
        bool r476164 = r476162 <= r476163;
        double r476165 = 0.0;
        double r476166 = b;
        double r476167 = y;
        double r476168 = r476166 - r476167;
        double r476169 = fma(r476162, r476168, r476167);
        double r476170 = r476165 / r476169;
        double r476171 = a;
        double r476172 = r476167 / r476162;
        double r476173 = r476172 + r476166;
        double r476174 = r476173 - r476167;
        double r476175 = r476171 / r476174;
        double r476176 = r476170 - r476175;
        double r476177 = -6.97840241981796e-298;
        bool r476178 = r476162 <= r476177;
        double r476179 = t;
        double r476180 = x;
        double r476181 = r476180 * r476167;
        double r476182 = fma(r476179, r476162, r476181);
        double r476183 = r476182 / r476169;
        double r476184 = 1.0;
        double r476185 = r476174 / r476171;
        double r476186 = r476184 / r476185;
        double r476187 = r476183 - r476186;
        double r476188 = 1.4056232999710475e-186;
        bool r476189 = r476162 <= r476188;
        double r476190 = fma(r476180, r476162, r476180);
        double r476191 = r476190 - r476175;
        double r476192 = r476184 / r476169;
        double r476193 = r476182 * r476192;
        double r476194 = r476193 - r476175;
        double r476195 = r476189 ? r476191 : r476194;
        double r476196 = r476178 ? r476187 : r476195;
        double r476197 = r476164 ? r476176 : r476196;
        return r476197;
}

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.0
Target17.8
Herbie18.6
\[\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 4 regimes
  2. if z < -6.665018424556654e+158

    1. Initial program 49.9

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

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

      \[\leadsto \frac{x \cdot y + \color{blue}{\left(z \cdot t + z \cdot \left(-a\right)\right)}}{y + z \cdot \left(b - y\right)}\]
    5. Using strategy rm
    6. Applied distribute-rgt-neg-out49.9

      \[\leadsto \frac{x \cdot y + \left(z \cdot t + \color{blue}{\left(-z \cdot a\right)}\right)}{y + z \cdot \left(b - y\right)}\]
    7. Applied unsub-neg49.9

      \[\leadsto \frac{x \cdot y + \color{blue}{\left(z \cdot t - z \cdot a\right)}}{y + z \cdot \left(b - y\right)}\]
    8. Applied associate-+r-49.9

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

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

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

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

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

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

    if -6.665018424556654e+158 < z < -6.97840241981796e-298

    1. Initial program 15.0

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

      \[\leadsto \frac{x \cdot y + z \cdot \color{blue}{\left(t + \left(-a\right)\right)}}{y + z \cdot \left(b - y\right)}\]
    4. Applied distribute-lft-in15.0

      \[\leadsto \frac{x \cdot y + \color{blue}{\left(z \cdot t + z \cdot \left(-a\right)\right)}}{y + z \cdot \left(b - y\right)}\]
    5. Using strategy rm
    6. Applied distribute-rgt-neg-out15.0

      \[\leadsto \frac{x \cdot y + \left(z \cdot t + \color{blue}{\left(-z \cdot a\right)}\right)}{y + z \cdot \left(b - y\right)}\]
    7. Applied unsub-neg15.0

      \[\leadsto \frac{x \cdot y + \color{blue}{\left(z \cdot t - z \cdot a\right)}}{y + z \cdot \left(b - y\right)}\]
    8. Applied associate-+r-15.0

      \[\leadsto \frac{\color{blue}{\left(x \cdot y + z \cdot t\right) - z \cdot a}}{y + z \cdot \left(b - y\right)}\]
    9. Applied div-sub15.0

      \[\leadsto \color{blue}{\frac{x \cdot y + z \cdot t}{y + z \cdot \left(b - y\right)} - \frac{z \cdot a}{y + z \cdot \left(b - y\right)}}\]
    10. Simplified15.0

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

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

      \[\leadsto \frac{\mathsf{fma}\left(t, z, x \cdot y\right)}{\mathsf{fma}\left(z, b - y, y\right)} - \frac{a}{\color{blue}{\left(\frac{y}{z} + b\right) - y}}\]
    13. Using strategy rm
    14. Applied clear-num13.0

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

    if -6.97840241981796e-298 < z < 1.4056232999710475e-186

    1. Initial program 8.5

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

      \[\leadsto \frac{x \cdot y + z \cdot \color{blue}{\left(t + \left(-a\right)\right)}}{y + z \cdot \left(b - y\right)}\]
    4. Applied distribute-lft-in8.5

      \[\leadsto \frac{x \cdot y + \color{blue}{\left(z \cdot t + z \cdot \left(-a\right)\right)}}{y + z \cdot \left(b - y\right)}\]
    5. Using strategy rm
    6. Applied distribute-rgt-neg-out8.5

      \[\leadsto \frac{x \cdot y + \left(z \cdot t + \color{blue}{\left(-z \cdot a\right)}\right)}{y + z \cdot \left(b - y\right)}\]
    7. Applied unsub-neg8.5

      \[\leadsto \frac{x \cdot y + \color{blue}{\left(z \cdot t - z \cdot a\right)}}{y + z \cdot \left(b - y\right)}\]
    8. Applied associate-+r-8.5

      \[\leadsto \frac{\color{blue}{\left(x \cdot y + z \cdot t\right) - z \cdot a}}{y + z \cdot \left(b - y\right)}\]
    9. Applied div-sub8.5

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

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

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

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

      \[\leadsto \color{blue}{\left(x \cdot z + x\right)} - \frac{a}{\left(\frac{y}{z} + b\right) - y}\]
    14. Simplified17.3

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

    if 1.4056232999710475e-186 < z

    1. Initial program 26.3

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

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

      \[\leadsto \frac{x \cdot y + \color{blue}{\left(z \cdot t + z \cdot \left(-a\right)\right)}}{y + z \cdot \left(b - y\right)}\]
    5. Using strategy rm
    6. Applied distribute-rgt-neg-out26.3

      \[\leadsto \frac{x \cdot y + \left(z \cdot t + \color{blue}{\left(-z \cdot a\right)}\right)}{y + z \cdot \left(b - y\right)}\]
    7. Applied unsub-neg26.3

      \[\leadsto \frac{x \cdot y + \color{blue}{\left(z \cdot t - z \cdot a\right)}}{y + z \cdot \left(b - y\right)}\]
    8. Applied associate-+r-26.3

      \[\leadsto \frac{\color{blue}{\left(x \cdot y + z \cdot t\right) - z \cdot a}}{y + z \cdot \left(b - y\right)}\]
    9. Applied div-sub26.3

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

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

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

      \[\leadsto \frac{\mathsf{fma}\left(t, z, x \cdot y\right)}{\mathsf{fma}\left(z, b - y, y\right)} - \frac{a}{\color{blue}{\left(\frac{y}{z} + b\right) - y}}\]
    13. Using strategy rm
    14. Applied div-inv19.7

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le -6.665018424556654185786159367392459116065 \cdot 10^{158}:\\ \;\;\;\;\frac{0}{\mathsf{fma}\left(z, b - y, y\right)} - \frac{a}{\left(\frac{y}{z} + b\right) - y}\\ \mathbf{elif}\;z \le -6.978402419817959865349829113622978959547 \cdot 10^{-298}:\\ \;\;\;\;\frac{\mathsf{fma}\left(t, z, x \cdot y\right)}{\mathsf{fma}\left(z, b - y, y\right)} - \frac{1}{\frac{\left(\frac{y}{z} + b\right) - y}{a}}\\ \mathbf{elif}\;z \le 1.405623299971047515023653888156309257696 \cdot 10^{-186}:\\ \;\;\;\;\mathsf{fma}\left(x, z, x\right) - \frac{a}{\left(\frac{y}{z} + b\right) - y}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(t, z, x \cdot y\right) \cdot \frac{1}{\mathsf{fma}\left(z, b - y, y\right)} - \frac{a}{\left(\frac{y}{z} + b\right) - y}\\ \end{array}\]

Reproduce

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