Average Error: 34.9 → 8.9
Time: 19.7s
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 -8.996672738587564338719979116635805174635 \cdot 10^{142}:\\ \;\;\;\;0.5 \cdot \frac{c}{b} - 0.6666666666666666296592325124947819858789 \cdot \frac{b}{a}\\ \mathbf{elif}\;b \le -7.56394763860733620958324268923116860948 \cdot 10^{-293}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}} \cdot \sqrt{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}}{3 \cdot a}\\ \mathbf{elif}\;b \le 12147289.8271790854632854461669921875:\\ \;\;\;\;\frac{1}{3} \cdot \frac{\frac{3 \cdot \left(a \cdot c\right)}{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}}{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 -8.996672738587564338719979116635805174635 \cdot 10^{142}:\\
\;\;\;\;0.5 \cdot \frac{c}{b} - 0.6666666666666666296592325124947819858789 \cdot \frac{b}{a}\\

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

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

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

\end{array}
double f(double a, double b, double c) {
        double r92405 = b;
        double r92406 = -r92405;
        double r92407 = r92405 * r92405;
        double r92408 = 3.0;
        double r92409 = a;
        double r92410 = r92408 * r92409;
        double r92411 = c;
        double r92412 = r92410 * r92411;
        double r92413 = r92407 - r92412;
        double r92414 = sqrt(r92413);
        double r92415 = r92406 + r92414;
        double r92416 = r92415 / r92410;
        return r92416;
}

double f(double a, double b, double c) {
        double r92417 = b;
        double r92418 = -8.996672738587564e+142;
        bool r92419 = r92417 <= r92418;
        double r92420 = 0.5;
        double r92421 = c;
        double r92422 = r92421 / r92417;
        double r92423 = r92420 * r92422;
        double r92424 = 0.6666666666666666;
        double r92425 = a;
        double r92426 = r92417 / r92425;
        double r92427 = r92424 * r92426;
        double r92428 = r92423 - r92427;
        double r92429 = -7.563947638607336e-293;
        bool r92430 = r92417 <= r92429;
        double r92431 = -r92417;
        double r92432 = r92417 * r92417;
        double r92433 = 3.0;
        double r92434 = r92433 * r92425;
        double r92435 = r92434 * r92421;
        double r92436 = r92432 - r92435;
        double r92437 = sqrt(r92436);
        double r92438 = sqrt(r92437);
        double r92439 = r92438 * r92438;
        double r92440 = r92431 + r92439;
        double r92441 = r92440 / r92434;
        double r92442 = 12147289.827179085;
        bool r92443 = r92417 <= r92442;
        double r92444 = 1.0;
        double r92445 = r92444 / r92433;
        double r92446 = r92425 * r92421;
        double r92447 = r92433 * r92446;
        double r92448 = r92431 - r92437;
        double r92449 = r92447 / r92448;
        double r92450 = r92449 / r92425;
        double r92451 = r92445 * r92450;
        double r92452 = -0.5;
        double r92453 = r92452 * r92422;
        double r92454 = r92443 ? r92451 : r92453;
        double r92455 = r92430 ? r92441 : r92454;
        double r92456 = r92419 ? r92428 : r92455;
        return r92456;
}

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 < -8.996672738587564e+142

    1. Initial program 59.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-+64.0

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

      \[\leadsto \frac{\frac{\color{blue}{0 + c \cdot \left(3 \cdot a\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-num62.8

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

      \[\leadsto \frac{\frac{1}{\color{blue}{\frac{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot \left(a \cdot c\right)}}}}{3 \cdot a}\]
    8. Taylor expanded around -inf 2.9

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

    if -8.996672738587564e+142 < b < -7.563947638607336e-293

    1. Initial program 9.2

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

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

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

    if -7.563947638607336e-293 < b < 12147289.827179085

    1. Initial program 27.0

      \[\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-+27.0

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

      \[\leadsto \frac{\frac{\color{blue}{0 + c \cdot \left(3 \cdot a\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-identity17.3

      \[\leadsto \frac{\frac{0 + c \cdot \left(3 \cdot a\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-identity17.3

      \[\leadsto \frac{\frac{\color{blue}{1 \cdot \left(0 + c \cdot \left(3 \cdot a\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-frac17.3

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

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

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

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

    if 12147289.827179085 < b

    1. Initial program 56.8

      \[\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-+56.8

      \[\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. Simplified27.1

      \[\leadsto \frac{\frac{\color{blue}{0 + c \cdot \left(3 \cdot a\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-num27.3

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

      \[\leadsto \frac{\frac{1}{\color{blue}{\frac{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot \left(a \cdot c\right)}}}}{3 \cdot a}\]
    8. Taylor expanded around inf 4.9

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le -8.996672738587564338719979116635805174635 \cdot 10^{142}:\\ \;\;\;\;0.5 \cdot \frac{c}{b} - 0.6666666666666666296592325124947819858789 \cdot \frac{b}{a}\\ \mathbf{elif}\;b \le -7.56394763860733620958324268923116860948 \cdot 10^{-293}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}} \cdot \sqrt{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}}{3 \cdot a}\\ \mathbf{elif}\;b \le 12147289.8271790854632854461669921875:\\ \;\;\;\;\frac{1}{3} \cdot \frac{\frac{3 \cdot \left(a \cdot c\right)}{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}}{a}\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{c}{b}\\ \end{array}\]

Reproduce

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