Average Error: 34.2 → 6.4
Time: 5.2s
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 -2.0079720992890853 \cdot 10^{154}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le 1.3179246153427595 \cdot 10^{-303}:\\ \;\;\;\;\frac{\frac{1}{a} \cdot 0 + c}{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}\\ \mathbf{elif}\;b_2 \le 2.89307072747620556 \cdot 10^{122}:\\ \;\;\;\;\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\\ \mathbf{else}:\\ \;\;\;\;-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 -2.0079720992890853 \cdot 10^{154}:\\
\;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\

\mathbf{elif}\;b_2 \le 1.3179246153427595 \cdot 10^{-303}:\\
\;\;\;\;\frac{\frac{1}{a} \cdot 0 + c}{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}\\

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

\mathbf{else}:\\
\;\;\;\;-2 \cdot \frac{b_2}{a}\\

\end{array}
double f(double a, double b_2, double c) {
        double r74308 = b_2;
        double r74309 = -r74308;
        double r74310 = r74308 * r74308;
        double r74311 = a;
        double r74312 = c;
        double r74313 = r74311 * r74312;
        double r74314 = r74310 - r74313;
        double r74315 = sqrt(r74314);
        double r74316 = r74309 - r74315;
        double r74317 = r74316 / r74311;
        return r74317;
}

double f(double a, double b_2, double c) {
        double r74318 = b_2;
        double r74319 = -2.0079720992890853e+154;
        bool r74320 = r74318 <= r74319;
        double r74321 = -0.5;
        double r74322 = c;
        double r74323 = r74322 / r74318;
        double r74324 = r74321 * r74323;
        double r74325 = 1.3179246153427595e-303;
        bool r74326 = r74318 <= r74325;
        double r74327 = 1.0;
        double r74328 = a;
        double r74329 = r74327 / r74328;
        double r74330 = 0.0;
        double r74331 = r74329 * r74330;
        double r74332 = r74331 + r74322;
        double r74333 = -r74318;
        double r74334 = r74318 * r74318;
        double r74335 = r74328 * r74322;
        double r74336 = r74334 - r74335;
        double r74337 = sqrt(r74336);
        double r74338 = r74333 + r74337;
        double r74339 = r74332 / r74338;
        double r74340 = 2.8930707274762056e+122;
        bool r74341 = r74318 <= r74340;
        double r74342 = r74333 - r74337;
        double r74343 = r74342 / r74328;
        double r74344 = -2.0;
        double r74345 = r74318 / r74328;
        double r74346 = r74344 * r74345;
        double r74347 = r74341 ? r74343 : r74346;
        double r74348 = r74326 ? r74339 : r74347;
        double r74349 = r74320 ? r74324 : r74348;
        return r74349;
}

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 < -2.0079720992890853e+154

    1. Initial program 64.0

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

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

    if -2.0079720992890853e+154 < b_2 < 1.3179246153427595e-303

    1. Initial program 34.0

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

      \[\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--34.0

      \[\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/34.0

      \[\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. Simplified14.0

      \[\leadsto \frac{\color{blue}{\frac{1}{a} \cdot 0 + \frac{1}{a} \cdot \left(a \cdot c\right)}}{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}\]
    8. Taylor expanded around 0 7.8

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

    if 1.3179246153427595e-303 < b_2 < 2.8930707274762056e+122

    1. Initial program 8.9

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

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

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

    if 2.8930707274762056e+122 < b_2

    1. Initial program 52.8

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

      \[\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--63.5

      \[\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/63.5

      \[\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. Simplified62.4

      \[\leadsto \frac{\color{blue}{\frac{1}{a} \cdot 0 + \frac{1}{a} \cdot \left(a \cdot c\right)}}{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}\]
    8. Taylor expanded around 0 62.2

      \[\leadsto \frac{\frac{1}{a} \cdot 0 + \color{blue}{c}}{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}\]
    9. Taylor expanded around 0 3.3

      \[\leadsto \color{blue}{-2 \cdot \frac{b_2}{a}}\]
  3. Recombined 4 regimes into one program.
  4. Final simplification6.4

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \le -2.0079720992890853 \cdot 10^{154}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le 1.3179246153427595 \cdot 10^{-303}:\\ \;\;\;\;\frac{\frac{1}{a} \cdot 0 + c}{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}\\ \mathbf{elif}\;b_2 \le 2.89307072747620556 \cdot 10^{122}:\\ \;\;\;\;\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\\ \mathbf{else}:\\ \;\;\;\;-2 \cdot \frac{b_2}{a}\\ \end{array}\]

Reproduce

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