Average Error: 34.1 → 8.3
Time: 6.3s
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 -5.9781116525486667988079736143201932298 \cdot 10^{136}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le -3.389290229286940203318575526144880311596 \cdot 10^{-293}:\\ \;\;\;\;\frac{\frac{1 \cdot \left(\left({b_2}^{2} - {b_2}^{2}\right) + a \cdot c\right)}{a}}{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}\\ \mathbf{elif}\;b_2 \le 1.156413586509534978562921370260547482111 \cdot 10^{129}:\\ \;\;\;\;1 \cdot \frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\\ \mathbf{else}:\\ \;\;\;\;1 \cdot \left(\frac{1}{2} \cdot \frac{c}{b_2} - 2 \cdot \frac{b_2}{a}\right)\\ \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 -5.9781116525486667988079736143201932298 \cdot 10^{136}:\\
\;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\

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

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

\mathbf{else}:\\
\;\;\;\;1 \cdot \left(\frac{1}{2} \cdot \frac{c}{b_2} - 2 \cdot \frac{b_2}{a}\right)\\

\end{array}
double f(double a, double b_2, double c) {
        double r74390 = b_2;
        double r74391 = -r74390;
        double r74392 = r74390 * r74390;
        double r74393 = a;
        double r74394 = c;
        double r74395 = r74393 * r74394;
        double r74396 = r74392 - r74395;
        double r74397 = sqrt(r74396);
        double r74398 = r74391 - r74397;
        double r74399 = r74398 / r74393;
        return r74399;
}

double f(double a, double b_2, double c) {
        double r74400 = b_2;
        double r74401 = -5.978111652548667e+136;
        bool r74402 = r74400 <= r74401;
        double r74403 = -0.5;
        double r74404 = c;
        double r74405 = r74404 / r74400;
        double r74406 = r74403 * r74405;
        double r74407 = -3.38929022928694e-293;
        bool r74408 = r74400 <= r74407;
        double r74409 = 1.0;
        double r74410 = 2.0;
        double r74411 = pow(r74400, r74410);
        double r74412 = r74411 - r74411;
        double r74413 = a;
        double r74414 = r74413 * r74404;
        double r74415 = r74412 + r74414;
        double r74416 = r74409 * r74415;
        double r74417 = r74416 / r74413;
        double r74418 = -r74400;
        double r74419 = r74400 * r74400;
        double r74420 = r74419 - r74414;
        double r74421 = sqrt(r74420);
        double r74422 = r74418 + r74421;
        double r74423 = r74417 / r74422;
        double r74424 = 1.156413586509535e+129;
        bool r74425 = r74400 <= r74424;
        double r74426 = r74418 - r74421;
        double r74427 = r74426 / r74413;
        double r74428 = r74409 * r74427;
        double r74429 = 0.5;
        double r74430 = r74429 * r74405;
        double r74431 = r74400 / r74413;
        double r74432 = r74410 * r74431;
        double r74433 = r74430 - r74432;
        double r74434 = r74409 * r74433;
        double r74435 = r74425 ? r74428 : r74434;
        double r74436 = r74408 ? r74423 : r74435;
        double r74437 = r74402 ? r74406 : r74436;
        return r74437;
}

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 < -5.978111652548667e+136

    1. Initial program 61.8

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

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

    if -5.978111652548667e+136 < b_2 < -3.38929022928694e-293

    1. Initial program 33.8

      \[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    2. Using strategy rm
    3. Applied clear-num33.8

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

      \[\leadsto \frac{1}{\frac{a}{\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}}}}}\]
    6. Applied associate-/r/33.9

      \[\leadsto \frac{1}{\color{blue}{\frac{a}{\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}} \cdot \left(\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}\right)}}\]
    7. Applied associate-/r*33.8

      \[\leadsto \color{blue}{\frac{\frac{1}{\frac{a}{\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}}}\]
    8. Simplified13.9

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

    if -3.38929022928694e-293 < b_2 < 1.156413586509535e+129

    1. Initial program 9.1

      \[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    2. Using strategy rm
    3. Applied *-un-lft-identity9.1

      \[\leadsto \frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{\color{blue}{1 \cdot a}}\]
    4. Applied *-un-lft-identity9.1

      \[\leadsto \frac{\color{blue}{1 \cdot \left(\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}\right)}}{1 \cdot a}\]
    5. Applied times-frac9.1

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

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

    if 1.156413586509535e+129 < b_2

    1. Initial program 54.4

      \[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    2. Using strategy rm
    3. Applied *-un-lft-identity54.4

      \[\leadsto \frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{\color{blue}{1 \cdot a}}\]
    4. Applied *-un-lft-identity54.4

      \[\leadsto \frac{\color{blue}{1 \cdot \left(\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}\right)}}{1 \cdot a}\]
    5. Applied times-frac54.4

      \[\leadsto \color{blue}{\frac{1}{1} \cdot \frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}}\]
    6. Simplified54.4

      \[\leadsto \color{blue}{1} \cdot \frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    7. Taylor expanded around inf 2.5

      \[\leadsto 1 \cdot \color{blue}{\left(\frac{1}{2} \cdot \frac{c}{b_2} - 2 \cdot \frac{b_2}{a}\right)}\]
  3. Recombined 4 regimes into one program.
  4. Final simplification8.3

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \le -5.9781116525486667988079736143201932298 \cdot 10^{136}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le -3.389290229286940203318575526144880311596 \cdot 10^{-293}:\\ \;\;\;\;\frac{\frac{1 \cdot \left(\left({b_2}^{2} - {b_2}^{2}\right) + a \cdot c\right)}{a}}{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}\\ \mathbf{elif}\;b_2 \le 1.156413586509534978562921370260547482111 \cdot 10^{129}:\\ \;\;\;\;1 \cdot \frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\\ \mathbf{else}:\\ \;\;\;\;1 \cdot \left(\frac{1}{2} \cdot \frac{c}{b_2} - 2 \cdot \frac{b_2}{a}\right)\\ \end{array}\]

Reproduce

herbie shell --seed 2019318 
(FPCore (a b_2 c)
  :name "NMSE problem 3.2.1"
  :precision binary64
  (/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a))