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

\mathbf{elif}\;b_2 \le 2.89307072747620556 \cdot 10^{122}:\\
\;\;\;\;1 \cdot \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 r14307 = b_2;
        double r14308 = -r14307;
        double r14309 = r14307 * r14307;
        double r14310 = a;
        double r14311 = c;
        double r14312 = r14310 * r14311;
        double r14313 = r14309 - r14312;
        double r14314 = sqrt(r14313);
        double r14315 = r14308 - r14314;
        double r14316 = r14315 / r14310;
        return r14316;
}

double f(double a, double b_2, double c) {
        double r14317 = b_2;
        double r14318 = -2.0079720992890853e+154;
        bool r14319 = r14317 <= r14318;
        double r14320 = -0.5;
        double r14321 = c;
        double r14322 = r14321 / r14317;
        double r14323 = r14320 * r14322;
        double r14324 = 1.3179246153427595e-303;
        bool r14325 = r14317 <= r14324;
        double r14326 = 1.0;
        double r14327 = a;
        double r14328 = r14326 / r14327;
        double r14329 = 0.0;
        double r14330 = r14328 * r14329;
        double r14331 = r14326 / r14326;
        double r14332 = r14331 * r14321;
        double r14333 = r14330 + r14332;
        double r14334 = -r14317;
        double r14335 = r14317 * r14317;
        double r14336 = r14327 * r14321;
        double r14337 = r14335 - r14336;
        double r14338 = sqrt(r14337);
        double r14339 = r14334 + r14338;
        double r14340 = r14333 / r14339;
        double r14341 = 2.8930707274762056e+122;
        bool r14342 = r14317 <= r14341;
        double r14343 = r14334 - r14338;
        double r14344 = r14343 / r14327;
        double r14345 = r14326 * r14344;
        double r14346 = -2.0;
        double r14347 = r14317 / r14327;
        double r14348 = r14346 * r14347;
        double r14349 = r14342 ? r14345 : r14348;
        double r14350 = r14325 ? r14340 : r14349;
        double r14351 = r14319 ? r14323 : r14350;
        return r14351;
}

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. Using strategy rm
    9. Applied *-un-lft-identity14.0

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

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

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

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

      \[\leadsto \frac{\frac{1}{a} \cdot 0 + \frac{1}{1} \cdot \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-lft-identity9.0

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

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

      \[\leadsto 1 \cdot \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. Using strategy rm
    9. Applied *-un-lft-identity62.4

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

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

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

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

      \[\leadsto \frac{\frac{1}{a} \cdot 0 + \frac{1}{1} \cdot \color{blue}{c}}{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}\]
    14. 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 + \frac{1}{1} \cdot c}{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}\\ \mathbf{elif}\;b_2 \le 2.89307072747620556 \cdot 10^{122}:\\ \;\;\;\;1 \cdot \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 "quad2m (problem 3.2.1, negative)"
  :precision binary64
  (/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a))