Average Error: 34.3 → 8.1
Time: 5.8s
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 -5.9551520595513616 \cdot 10^{118}:\\ \;\;\;\;0.5 \cdot \frac{c}{b} - 0.66666666666666663 \cdot \frac{b}{a}\\ \mathbf{elif}\;b \le -1.53142763806062239 \cdot 10^{-259}:\\ \;\;\;\;\frac{\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3}}{a}\\ \mathbf{elif}\;b \le 5.3300268467023164 \cdot 10^{29}:\\ \;\;\;\;\frac{1 \cdot \frac{3}{\frac{1}{a} \cdot \frac{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{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 -5.9551520595513616 \cdot 10^{118}:\\
\;\;\;\;0.5 \cdot \frac{c}{b} - 0.66666666666666663 \cdot \frac{b}{a}\\

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

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

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

\end{array}
double f(double a, double b, double c) {
        double r116458 = b;
        double r116459 = -r116458;
        double r116460 = r116458 * r116458;
        double r116461 = 3.0;
        double r116462 = a;
        double r116463 = r116461 * r116462;
        double r116464 = c;
        double r116465 = r116463 * r116464;
        double r116466 = r116460 - r116465;
        double r116467 = sqrt(r116466);
        double r116468 = r116459 + r116467;
        double r116469 = r116468 / r116463;
        return r116469;
}

double f(double a, double b, double c) {
        double r116470 = b;
        double r116471 = -5.955152059551362e+118;
        bool r116472 = r116470 <= r116471;
        double r116473 = 0.5;
        double r116474 = c;
        double r116475 = r116474 / r116470;
        double r116476 = r116473 * r116475;
        double r116477 = 0.6666666666666666;
        double r116478 = a;
        double r116479 = r116470 / r116478;
        double r116480 = r116477 * r116479;
        double r116481 = r116476 - r116480;
        double r116482 = -1.5314276380606224e-259;
        bool r116483 = r116470 <= r116482;
        double r116484 = -r116470;
        double r116485 = r116470 * r116470;
        double r116486 = 3.0;
        double r116487 = r116486 * r116478;
        double r116488 = r116487 * r116474;
        double r116489 = r116485 - r116488;
        double r116490 = sqrt(r116489);
        double r116491 = r116484 + r116490;
        double r116492 = r116491 / r116486;
        double r116493 = r116492 / r116478;
        double r116494 = 5.3300268467023164e+29;
        bool r116495 = r116470 <= r116494;
        double r116496 = 1.0;
        double r116497 = r116496 / r116478;
        double r116498 = r116484 - r116490;
        double r116499 = r116498 / r116474;
        double r116500 = r116497 * r116499;
        double r116501 = r116486 / r116500;
        double r116502 = r116496 * r116501;
        double r116503 = r116502 / r116487;
        double r116504 = -0.5;
        double r116505 = r116504 * r116475;
        double r116506 = r116495 ? r116503 : r116505;
        double r116507 = r116483 ? r116493 : r116506;
        double r116508 = r116472 ? r116481 : r116507;
        return r116508;
}

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 < -5.955152059551362e+118

    1. Initial program 52.2

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

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

    if -5.955152059551362e+118 < b < -1.5314276380606224e-259

    1. Initial program 7.9

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
    2. Using strategy rm
    3. Applied associate-/r*7.9

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

    if -1.5314276380606224e-259 < b < 5.3300268467023164e+29

    1. Initial program 26.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 flip-+26.6

      \[\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 *-un-lft-identity16.9

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

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

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

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

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

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

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

    if 5.3300268467023164e+29 < b

    1. Initial program 56.7

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le -5.9551520595513616 \cdot 10^{118}:\\ \;\;\;\;0.5 \cdot \frac{c}{b} - 0.66666666666666663 \cdot \frac{b}{a}\\ \mathbf{elif}\;b \le -1.53142763806062239 \cdot 10^{-259}:\\ \;\;\;\;\frac{\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3}}{a}\\ \mathbf{elif}\;b \le 5.3300268467023164 \cdot 10^{29}:\\ \;\;\;\;\frac{1 \cdot \frac{3}{\frac{1}{a} \cdot \frac{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{c}}}{3 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{c}{b}\\ \end{array}\]

Reproduce

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