Average Error: 34.5 → 8.3
Time: 13.9s
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 -1.074236564300795243531937121549640674772 \cdot 10^{154}:\\ \;\;\;\;0.5 \cdot \frac{c}{b} - 0.6666666666666666296592325124947819858789 \cdot \frac{b}{a}\\ \mathbf{elif}\;b \le 6.517962713462531947226071828920786056372 \cdot 10^{-274}:\\ \;\;\;\;\frac{1 \cdot \left(\sqrt{b \cdot b - \left(3 \cdot c\right) \cdot a} - b\right)}{3 \cdot a}\\ \mathbf{elif}\;b \le 1.442637692707308793783035100371361354767 \cdot 10^{94}:\\ \;\;\;\;\frac{1 \cdot \frac{3}{\frac{\frac{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot c\right) \cdot a}}{a}}{c}}}{3 \cdot a}\\ \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 -1.074236564300795243531937121549640674772 \cdot 10^{154}:\\
\;\;\;\;0.5 \cdot \frac{c}{b} - 0.6666666666666666296592325124947819858789 \cdot \frac{b}{a}\\

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

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

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

\end{array}
double f(double a, double b, double c) {
        double r86467 = b;
        double r86468 = -r86467;
        double r86469 = r86467 * r86467;
        double r86470 = 3.0;
        double r86471 = a;
        double r86472 = r86470 * r86471;
        double r86473 = c;
        double r86474 = r86472 * r86473;
        double r86475 = r86469 - r86474;
        double r86476 = sqrt(r86475);
        double r86477 = r86468 + r86476;
        double r86478 = r86477 / r86472;
        return r86478;
}

double f(double a, double b, double c) {
        double r86479 = b;
        double r86480 = -1.0742365643007952e+154;
        bool r86481 = r86479 <= r86480;
        double r86482 = 0.5;
        double r86483 = c;
        double r86484 = r86483 / r86479;
        double r86485 = r86482 * r86484;
        double r86486 = 0.6666666666666666;
        double r86487 = a;
        double r86488 = r86479 / r86487;
        double r86489 = r86486 * r86488;
        double r86490 = r86485 - r86489;
        double r86491 = 6.517962713462532e-274;
        bool r86492 = r86479 <= r86491;
        double r86493 = 1.0;
        double r86494 = r86479 * r86479;
        double r86495 = 3.0;
        double r86496 = r86495 * r86483;
        double r86497 = r86496 * r86487;
        double r86498 = r86494 - r86497;
        double r86499 = sqrt(r86498);
        double r86500 = r86499 - r86479;
        double r86501 = r86493 * r86500;
        double r86502 = r86495 * r86487;
        double r86503 = r86501 / r86502;
        double r86504 = 1.4426376927073088e+94;
        bool r86505 = r86479 <= r86504;
        double r86506 = -r86479;
        double r86507 = r86506 - r86499;
        double r86508 = r86507 / r86487;
        double r86509 = r86508 / r86483;
        double r86510 = r86495 / r86509;
        double r86511 = r86493 * r86510;
        double r86512 = r86511 / r86502;
        double r86513 = -0.5;
        double r86514 = r86513 * r86484;
        double r86515 = r86505 ? r86512 : r86514;
        double r86516 = r86492 ? r86503 : r86515;
        double r86517 = r86481 ? r86490 : r86516;
        return r86517;
}

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

    1. Initial program 63.9

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

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

    if -1.0742365643007952e+154 < b < 6.517962713462532e-274

    1. Initial program 9.5

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

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

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

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

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

    if 6.517962713462532e-274 < b < 1.4426376927073088e+94

    1. Initial program 32.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 flip-+32.7

      \[\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. Simplified15.3

      \[\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 *-un-lft-identity15.3

      \[\leadsto \frac{\frac{0 + 3 \cdot \left(a \cdot c\right)}{\color{blue}{1 \cdot \left(\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right)}}}{3 \cdot a}\]
    7. Applied *-un-lft-identity15.3

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

      \[\leadsto \frac{\color{blue}{\frac{1}{1} \cdot \frac{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}\]
    9. Simplified15.3

      \[\leadsto \frac{\color{blue}{1} \cdot \frac{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}\]
    10. Simplified15.5

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

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

    if 1.4426376927073088e+94 < b

    1. Initial program 59.4

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le -1.074236564300795243531937121549640674772 \cdot 10^{154}:\\ \;\;\;\;0.5 \cdot \frac{c}{b} - 0.6666666666666666296592325124947819858789 \cdot \frac{b}{a}\\ \mathbf{elif}\;b \le 6.517962713462531947226071828920786056372 \cdot 10^{-274}:\\ \;\;\;\;\frac{1 \cdot \left(\sqrt{b \cdot b - \left(3 \cdot c\right) \cdot a} - b\right)}{3 \cdot a}\\ \mathbf{elif}\;b \le 1.442637692707308793783035100371361354767 \cdot 10^{94}:\\ \;\;\;\;\frac{1 \cdot \frac{3}{\frac{\frac{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot c\right) \cdot a}}{a}}{c}}}{3 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{c}{b}\\ \end{array}\]

Reproduce

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