Average Error: 34.7 → 8.9
Time: 5.3s
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.329298386451440676631327446927623911346 \cdot 10^{154}:\\ \;\;\;\;\frac{\left(-b\right) + \left(1.5 \cdot \frac{a \cdot c}{b} - b\right)}{3 \cdot a}\\ \mathbf{elif}\;b \le -8.887624764985494947900416379846939642691 \cdot 10^{-175}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\\ \mathbf{elif}\;b \le 6.167898436296758304385773759338301434281 \cdot 10^{152}:\\ \;\;\;\;\frac{c}{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{1}{\frac{c}{1}} \cdot \left(\left(-b\right) - \left(b - 1.5 \cdot \frac{a \cdot c}{b}\right)\right)}\\ \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.329298386451440676631327446927623911346 \cdot 10^{154}:\\
\;\;\;\;\frac{\left(-b\right) + \left(1.5 \cdot \frac{a \cdot c}{b} - b\right)}{3 \cdot a}\\

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

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

\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{1}{\frac{c}{1}} \cdot \left(\left(-b\right) - \left(b - 1.5 \cdot \frac{a \cdot c}{b}\right)\right)}\\

\end{array}
double f(double a, double b, double c) {
        double r121367 = b;
        double r121368 = -r121367;
        double r121369 = r121367 * r121367;
        double r121370 = 3.0;
        double r121371 = a;
        double r121372 = r121370 * r121371;
        double r121373 = c;
        double r121374 = r121372 * r121373;
        double r121375 = r121369 - r121374;
        double r121376 = sqrt(r121375);
        double r121377 = r121368 + r121376;
        double r121378 = r121377 / r121372;
        return r121378;
}

double f(double a, double b, double c) {
        double r121379 = b;
        double r121380 = -1.3292983864514407e+154;
        bool r121381 = r121379 <= r121380;
        double r121382 = -r121379;
        double r121383 = 1.5;
        double r121384 = a;
        double r121385 = c;
        double r121386 = r121384 * r121385;
        double r121387 = r121386 / r121379;
        double r121388 = r121383 * r121387;
        double r121389 = r121388 - r121379;
        double r121390 = r121382 + r121389;
        double r121391 = 3.0;
        double r121392 = r121391 * r121384;
        double r121393 = r121390 / r121392;
        double r121394 = -8.887624764985495e-175;
        bool r121395 = r121379 <= r121394;
        double r121396 = r121379 * r121379;
        double r121397 = r121392 * r121385;
        double r121398 = r121396 - r121397;
        double r121399 = sqrt(r121398);
        double r121400 = r121382 + r121399;
        double r121401 = r121400 / r121392;
        double r121402 = 6.167898436296758e+152;
        bool r121403 = r121379 <= r121402;
        double r121404 = r121382 - r121399;
        double r121405 = r121385 / r121404;
        double r121406 = 1.0;
        double r121407 = r121385 / r121406;
        double r121408 = r121406 / r121407;
        double r121409 = r121379 - r121388;
        double r121410 = r121382 - r121409;
        double r121411 = r121408 * r121410;
        double r121412 = r121406 / r121411;
        double r121413 = r121403 ? r121405 : r121412;
        double r121414 = r121395 ? r121401 : r121413;
        double r121415 = r121381 ? r121393 : r121414;
        return r121415;
}

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.3292983864514407e+154

    1. Initial program 64.0

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

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

    if -1.3292983864514407e+154 < b < -8.887624764985495e-175

    1. Initial program 7.6

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

    if -8.887624764985495e-175 < b < 6.167898436296758e+152

    1. Initial program 31.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-+31.4

      \[\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.6

      \[\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-num16.7

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

      \[\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 clear-num15.4

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

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

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

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

    if 6.167898436296758e+152 < b

    1. Initial program 63.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-+63.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. Simplified38.5

      \[\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-num38.5

      \[\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. Simplified38.4

      \[\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 clear-num38.4

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

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

      \[\leadsto \frac{1}{\frac{1}{\frac{c}{1}} \cdot \left(\left(-b\right) - \color{blue}{\left(b - 1.5 \cdot \frac{a \cdot c}{b}\right)}\right)}\]
  3. Recombined 4 regimes into one program.
  4. Final simplification8.9

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le -1.329298386451440676631327446927623911346 \cdot 10^{154}:\\ \;\;\;\;\frac{\left(-b\right) + \left(1.5 \cdot \frac{a \cdot c}{b} - b\right)}{3 \cdot a}\\ \mathbf{elif}\;b \le -8.887624764985494947900416379846939642691 \cdot 10^{-175}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\\ \mathbf{elif}\;b \le 6.167898436296758304385773759338301434281 \cdot 10^{152}:\\ \;\;\;\;\frac{c}{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{1}{\frac{c}{1}} \cdot \left(\left(-b\right) - \left(b - 1.5 \cdot \frac{a \cdot c}{b}\right)\right)}\\ \end{array}\]

Reproduce

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