Average Error: 34.1 → 8.2
Time: 9.1s
Precision: 64
\[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
\[\begin{array}{l} \mathbf{if}\;b \le -2.001685131789919101473978236207081236745 \cdot 10^{-27}:\\ \;\;\;\;0.5 \cdot \frac{c}{b} - 0.6666666666666666296592325124947819858789 \cdot \frac{b}{a}\\ \mathbf{elif}\;b \le -1.014814378774540764354991882122975430781 \cdot 10^{-305}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - {\left(3 \cdot \left(a \cdot c\right)\right)}^{1}}}{3 \cdot a}\\ \mathbf{elif}\;b \le 2.730494439370032074747470763239053019705 \cdot 10^{75}:\\ \;\;\;\;\frac{\frac{1}{\sqrt[3]{1} \cdot \sqrt[3]{1}} \cdot \frac{c}{\sqrt[3]{1}}}{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{c}{b}\\ \end{array}\]
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}
\begin{array}{l}
\mathbf{if}\;b \le -2.001685131789919101473978236207081236745 \cdot 10^{-27}:\\
\;\;\;\;0.5 \cdot \frac{c}{b} - 0.6666666666666666296592325124947819858789 \cdot \frac{b}{a}\\

\mathbf{elif}\;b \le -1.014814378774540764354991882122975430781 \cdot 10^{-305}:\\
\;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - {\left(3 \cdot \left(a \cdot c\right)\right)}^{1}}}{3 \cdot a}\\

\mathbf{elif}\;b \le 2.730494439370032074747470763239053019705 \cdot 10^{75}:\\
\;\;\;\;\frac{\frac{1}{\sqrt[3]{1} \cdot \sqrt[3]{1}} \cdot \frac{c}{\sqrt[3]{1}}}{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}\\

\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\

\end{array}
double f(double a, double b, double c) {
        double r95382 = b;
        double r95383 = -r95382;
        double r95384 = r95382 * r95382;
        double r95385 = 3.0;
        double r95386 = a;
        double r95387 = r95385 * r95386;
        double r95388 = c;
        double r95389 = r95387 * r95388;
        double r95390 = r95384 - r95389;
        double r95391 = sqrt(r95390);
        double r95392 = r95383 + r95391;
        double r95393 = r95392 / r95387;
        return r95393;
}

double f(double a, double b, double c) {
        double r95394 = b;
        double r95395 = -2.001685131789919e-27;
        bool r95396 = r95394 <= r95395;
        double r95397 = 0.5;
        double r95398 = c;
        double r95399 = r95398 / r95394;
        double r95400 = r95397 * r95399;
        double r95401 = 0.6666666666666666;
        double r95402 = a;
        double r95403 = r95394 / r95402;
        double r95404 = r95401 * r95403;
        double r95405 = r95400 - r95404;
        double r95406 = -1.0148143787745408e-305;
        bool r95407 = r95394 <= r95406;
        double r95408 = -r95394;
        double r95409 = r95394 * r95394;
        double r95410 = 3.0;
        double r95411 = r95402 * r95398;
        double r95412 = r95410 * r95411;
        double r95413 = 1.0;
        double r95414 = pow(r95412, r95413);
        double r95415 = r95409 - r95414;
        double r95416 = sqrt(r95415);
        double r95417 = r95408 + r95416;
        double r95418 = r95410 * r95402;
        double r95419 = r95417 / r95418;
        double r95420 = 2.730494439370032e+75;
        bool r95421 = r95394 <= r95420;
        double r95422 = cbrt(r95413);
        double r95423 = r95422 * r95422;
        double r95424 = r95413 / r95423;
        double r95425 = r95398 / r95422;
        double r95426 = r95424 * r95425;
        double r95427 = r95418 * r95398;
        double r95428 = r95409 - r95427;
        double r95429 = sqrt(r95428);
        double r95430 = r95408 - r95429;
        double r95431 = r95426 / r95430;
        double r95432 = -0.5;
        double r95433 = r95432 * r95399;
        double r95434 = r95421 ? r95431 : r95433;
        double r95435 = r95407 ? r95419 : r95434;
        double r95436 = r95396 ? r95405 : r95435;
        return r95436;
}

Error

Bits error versus a

Bits error versus b

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.001685131789919e-27

    1. Initial program 29.9

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
    2. Taylor expanded around -inf 9.4

      \[\leadsto \color{blue}{0.5 \cdot \frac{c}{b} - 0.6666666666666666296592325124947819858789 \cdot \frac{b}{a}}\]

    if -2.001685131789919e-27 < b < -1.0148143787745408e-305

    1. Initial program 11.7

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
    2. Using strategy rm
    3. Applied pow111.7

      \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot \color{blue}{{c}^{1}}}}{3 \cdot a}\]
    4. Applied pow111.7

      \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot \color{blue}{{a}^{1}}\right) \cdot {c}^{1}}}{3 \cdot a}\]
    5. Applied pow111.7

      \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \left(\color{blue}{{3}^{1}} \cdot {a}^{1}\right) \cdot {c}^{1}}}{3 \cdot a}\]
    6. Applied pow-prod-down11.7

      \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \color{blue}{{\left(3 \cdot a\right)}^{1}} \cdot {c}^{1}}}{3 \cdot a}\]
    7. Applied pow-prod-down11.7

      \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \color{blue}{{\left(\left(3 \cdot a\right) \cdot c\right)}^{1}}}}{3 \cdot a}\]
    8. Simplified11.8

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

    if -1.0148143787745408e-305 < b < 2.730494439370032e+75

    1. Initial program 30.3

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
    2. Using strategy rm
    3. Applied flip-+30.3

      \[\leadsto \frac{\color{blue}{\frac{\left(-b\right) \cdot \left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} \cdot \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}}}{3 \cdot a}\]
    4. Simplified16.9

      \[\leadsto \frac{\frac{\color{blue}{0 + 3 \cdot \left(a \cdot c\right)}}{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}}{3 \cdot a}\]
    5. Using strategy rm
    6. Applied clear-num17.0

      \[\leadsto \color{blue}{\frac{1}{\frac{3 \cdot a}{\frac{0 + 3 \cdot \left(a \cdot c\right)}{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}}}}\]
    7. Simplified16.2

      \[\leadsto \frac{1}{\color{blue}{\frac{3 \cdot a}{3 \cdot \left(a \cdot c\right)} \cdot \left(\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right)}}\]
    8. Using strategy rm
    9. Applied associate-/r*16.0

      \[\leadsto \color{blue}{\frac{\frac{1}{\frac{3 \cdot a}{3 \cdot \left(a \cdot c\right)}}}{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}}\]
    10. Simplified9.4

      \[\leadsto \frac{\color{blue}{\frac{1}{\frac{1}{c}}}}{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}\]
    11. Using strategy rm
    12. Applied *-un-lft-identity9.4

      \[\leadsto \frac{\frac{1}{\frac{1}{\color{blue}{1 \cdot c}}}}{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}\]
    13. Applied add-cube-cbrt9.4

      \[\leadsto \frac{\frac{1}{\frac{\color{blue}{\left(\sqrt[3]{1} \cdot \sqrt[3]{1}\right) \cdot \sqrt[3]{1}}}{1 \cdot c}}}{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}\]
    14. Applied times-frac9.4

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

      \[\leadsto \frac{\frac{\color{blue}{1 \cdot 1}}{\frac{\sqrt[3]{1} \cdot \sqrt[3]{1}}{1} \cdot \frac{\sqrt[3]{1}}{c}}}{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}\]
    16. Applied times-frac9.4

      \[\leadsto \frac{\color{blue}{\frac{1}{\frac{\sqrt[3]{1} \cdot \sqrt[3]{1}}{1}} \cdot \frac{1}{\frac{\sqrt[3]{1}}{c}}}}{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}\]
    17. Simplified9.4

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

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

    if 2.730494439370032e+75 < b

    1. Initial program 58.6

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
    2. Taylor expanded around inf 3.4

      \[\leadsto \color{blue}{-0.5 \cdot \frac{c}{b}}\]
  3. Recombined 4 regimes into one program.
  4. Final simplification8.2

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le -2.001685131789919101473978236207081236745 \cdot 10^{-27}:\\ \;\;\;\;0.5 \cdot \frac{c}{b} - 0.6666666666666666296592325124947819858789 \cdot \frac{b}{a}\\ \mathbf{elif}\;b \le -1.014814378774540764354991882122975430781 \cdot 10^{-305}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - {\left(3 \cdot \left(a \cdot c\right)\right)}^{1}}}{3 \cdot a}\\ \mathbf{elif}\;b \le 2.730494439370032074747470763239053019705 \cdot 10^{75}:\\ \;\;\;\;\frac{\frac{1}{\sqrt[3]{1} \cdot \sqrt[3]{1}} \cdot \frac{c}{\sqrt[3]{1}}}{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{c}{b}\\ \end{array}\]

Reproduce

herbie shell --seed 2019308 
(FPCore (a b c)
  :name "Cubic critical"
  :precision binary64
  (/ (+ (- b) (sqrt (- (* b b) (* (* 3 a) c)))) (* 3 a)))