Average Error: 33.9 → 10.9
Time: 4.8s
Precision: 64
\[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
\[\begin{array}{l} \mathbf{if}\;b_2 \le -2200.014963884743337985128164291381835938:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le -2.332637431447364623268840018977048343656 \cdot 10^{-95}:\\ \;\;\;\;\frac{\frac{{b_2}^{2}}{a} - \frac{b_2 \cdot b_2 - a \cdot c}{a}}{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}\\ \mathbf{elif}\;b_2 \le -1.642868784686771959253301844332455949634 \cdot 10^{-124}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le 2.578980439773996833308311441044417137702 \cdot 10^{94}:\\ \;\;\;\;\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{2}}{\sqrt[3]{b_2} \cdot \sqrt[3]{b_2}} \cdot \frac{c}{\sqrt[3]{b_2}} - 2 \cdot \frac{b_2}{a}\\ \end{array}\]
\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}
\begin{array}{l}
\mathbf{if}\;b_2 \le -2200.014963884743337985128164291381835938:\\
\;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\

\mathbf{elif}\;b_2 \le -2.332637431447364623268840018977048343656 \cdot 10^{-95}:\\
\;\;\;\;\frac{\frac{{b_2}^{2}}{a} - \frac{b_2 \cdot b_2 - a \cdot c}{a}}{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}\\

\mathbf{elif}\;b_2 \le -1.642868784686771959253301844332455949634 \cdot 10^{-124}:\\
\;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\

\mathbf{elif}\;b_2 \le 2.578980439773996833308311441044417137702 \cdot 10^{94}:\\
\;\;\;\;\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{2}}{\sqrt[3]{b_2} \cdot \sqrt[3]{b_2}} \cdot \frac{c}{\sqrt[3]{b_2}} - 2 \cdot \frac{b_2}{a}\\

\end{array}
double f(double a, double b_2, double c) {
        double r81298 = b_2;
        double r81299 = -r81298;
        double r81300 = r81298 * r81298;
        double r81301 = a;
        double r81302 = c;
        double r81303 = r81301 * r81302;
        double r81304 = r81300 - r81303;
        double r81305 = sqrt(r81304);
        double r81306 = r81299 - r81305;
        double r81307 = r81306 / r81301;
        return r81307;
}

double f(double a, double b_2, double c) {
        double r81308 = b_2;
        double r81309 = -2200.0149638847433;
        bool r81310 = r81308 <= r81309;
        double r81311 = -0.5;
        double r81312 = c;
        double r81313 = r81312 / r81308;
        double r81314 = r81311 * r81313;
        double r81315 = -2.3326374314473646e-95;
        bool r81316 = r81308 <= r81315;
        double r81317 = 2.0;
        double r81318 = pow(r81308, r81317);
        double r81319 = a;
        double r81320 = r81318 / r81319;
        double r81321 = r81308 * r81308;
        double r81322 = r81319 * r81312;
        double r81323 = r81321 - r81322;
        double r81324 = r81323 / r81319;
        double r81325 = r81320 - r81324;
        double r81326 = -r81308;
        double r81327 = sqrt(r81323);
        double r81328 = r81326 + r81327;
        double r81329 = r81325 / r81328;
        double r81330 = -1.642868784686772e-124;
        bool r81331 = r81308 <= r81330;
        double r81332 = 2.578980439773997e+94;
        bool r81333 = r81308 <= r81332;
        double r81334 = r81326 - r81327;
        double r81335 = r81334 / r81319;
        double r81336 = 0.5;
        double r81337 = cbrt(r81308);
        double r81338 = r81337 * r81337;
        double r81339 = r81336 / r81338;
        double r81340 = r81312 / r81337;
        double r81341 = r81339 * r81340;
        double r81342 = r81308 / r81319;
        double r81343 = r81317 * r81342;
        double r81344 = r81341 - r81343;
        double r81345 = r81333 ? r81335 : r81344;
        double r81346 = r81331 ? r81314 : r81345;
        double r81347 = r81316 ? r81329 : r81346;
        double r81348 = r81310 ? r81314 : r81347;
        return r81348;
}

Error

Bits error versus a

Bits error versus b_2

Bits error versus c

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 4 regimes
  2. if b_2 < -2200.0149638847433 or -2.3326374314473646e-95 < b_2 < -1.642868784686772e-124

    1. Initial program 54.1

      \[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    2. Taylor expanded around -inf 8.0

      \[\leadsto \color{blue}{\frac{-1}{2} \cdot \frac{c}{b_2}}\]

    if -2200.0149638847433 < b_2 < -2.3326374314473646e-95

    1. Initial program 36.5

      \[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    2. Using strategy rm
    3. Applied div-inv36.5

      \[\leadsto \color{blue}{\left(\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}\right) \cdot \frac{1}{a}}\]
    4. Using strategy rm
    5. Applied flip--36.6

      \[\leadsto \color{blue}{\frac{\left(-b_2\right) \cdot \left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c} \cdot \sqrt{b_2 \cdot b_2 - a \cdot c}}{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}} \cdot \frac{1}{a}\]
    6. Applied associate-*l/36.6

      \[\leadsto \color{blue}{\frac{\left(\left(-b_2\right) \cdot \left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c} \cdot \sqrt{b_2 \cdot b_2 - a \cdot c}\right) \cdot \frac{1}{a}}{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}}\]
    7. Simplified36.5

      \[\leadsto \frac{\color{blue}{\frac{{b_2}^{2}}{a} - \frac{b_2 \cdot b_2 - a \cdot c}{a}}}{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}\]

    if -1.642868784686772e-124 < b_2 < 2.578980439773997e+94

    1. Initial program 11.5

      \[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    2. Using strategy rm
    3. Applied div-inv11.6

      \[\leadsto \color{blue}{\left(\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}\right) \cdot \frac{1}{a}}\]
    4. Using strategy rm
    5. Applied un-div-inv11.5

      \[\leadsto \color{blue}{\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}}\]

    if 2.578980439773997e+94 < b_2

    1. Initial program 44.8

      \[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    2. Taylor expanded around inf 3.7

      \[\leadsto \color{blue}{\frac{1}{2} \cdot \frac{c}{b_2} - 2 \cdot \frac{b_2}{a}}\]
    3. Using strategy rm
    4. Applied add-cube-cbrt3.7

      \[\leadsto \frac{1}{2} \cdot \frac{c}{\color{blue}{\left(\sqrt[3]{b_2} \cdot \sqrt[3]{b_2}\right) \cdot \sqrt[3]{b_2}}} - 2 \cdot \frac{b_2}{a}\]
    5. Applied *-un-lft-identity3.7

      \[\leadsto \frac{1}{2} \cdot \frac{\color{blue}{1 \cdot c}}{\left(\sqrt[3]{b_2} \cdot \sqrt[3]{b_2}\right) \cdot \sqrt[3]{b_2}} - 2 \cdot \frac{b_2}{a}\]
    6. Applied times-frac3.7

      \[\leadsto \frac{1}{2} \cdot \color{blue}{\left(\frac{1}{\sqrt[3]{b_2} \cdot \sqrt[3]{b_2}} \cdot \frac{c}{\sqrt[3]{b_2}}\right)} - 2 \cdot \frac{b_2}{a}\]
    7. Applied associate-*r*3.7

      \[\leadsto \color{blue}{\left(\frac{1}{2} \cdot \frac{1}{\sqrt[3]{b_2} \cdot \sqrt[3]{b_2}}\right) \cdot \frac{c}{\sqrt[3]{b_2}}} - 2 \cdot \frac{b_2}{a}\]
    8. Simplified3.7

      \[\leadsto \color{blue}{\frac{\frac{1}{2}}{\sqrt[3]{b_2} \cdot \sqrt[3]{b_2}}} \cdot \frac{c}{\sqrt[3]{b_2}} - 2 \cdot \frac{b_2}{a}\]
  3. Recombined 4 regimes into one program.
  4. Final simplification10.9

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \le -2200.014963884743337985128164291381835938:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le -2.332637431447364623268840018977048343656 \cdot 10^{-95}:\\ \;\;\;\;\frac{\frac{{b_2}^{2}}{a} - \frac{b_2 \cdot b_2 - a \cdot c}{a}}{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}\\ \mathbf{elif}\;b_2 \le -1.642868784686771959253301844332455949634 \cdot 10^{-124}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le 2.578980439773996833308311441044417137702 \cdot 10^{94}:\\ \;\;\;\;\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{2}}{\sqrt[3]{b_2} \cdot \sqrt[3]{b_2}} \cdot \frac{c}{\sqrt[3]{b_2}} - 2 \cdot \frac{b_2}{a}\\ \end{array}\]

Reproduce

herbie shell --seed 2019346 +o rules:numerics
(FPCore (a b_2 c)
  :name "NMSE problem 3.2.1"
  :precision binary64
  (/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a))