Average Error: 34.5 → 10.1
Time: 4.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 -1.018762283622710426864404427574628112872 \cdot 10^{102}:\\ \;\;\;\;\frac{1}{3} \cdot \left(1.5 \cdot \frac{c}{b} - 2 \cdot \frac{b}{a}\right)\\ \mathbf{elif}\;b \le 1.209120745343099452134664059704875392955 \cdot 10^{-70}:\\ \;\;\;\;\frac{\frac{\left(-b\right) + \sqrt{b \cdot b - {\left(3 \cdot \left(a \cdot c\right)\right)}^{1}}}{3}}{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.018762283622710426864404427574628112872 \cdot 10^{102}:\\
\;\;\;\;\frac{1}{3} \cdot \left(1.5 \cdot \frac{c}{b} - 2 \cdot \frac{b}{a}\right)\\

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

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

\end{array}
double f(double a, double b, double c) {
        double r89344 = b;
        double r89345 = -r89344;
        double r89346 = r89344 * r89344;
        double r89347 = 3.0;
        double r89348 = a;
        double r89349 = r89347 * r89348;
        double r89350 = c;
        double r89351 = r89349 * r89350;
        double r89352 = r89346 - r89351;
        double r89353 = sqrt(r89352);
        double r89354 = r89345 + r89353;
        double r89355 = r89354 / r89349;
        return r89355;
}

double f(double a, double b, double c) {
        double r89356 = b;
        double r89357 = -1.0187622836227104e+102;
        bool r89358 = r89356 <= r89357;
        double r89359 = 1.0;
        double r89360 = 3.0;
        double r89361 = r89359 / r89360;
        double r89362 = 1.5;
        double r89363 = c;
        double r89364 = r89363 / r89356;
        double r89365 = r89362 * r89364;
        double r89366 = 2.0;
        double r89367 = a;
        double r89368 = r89356 / r89367;
        double r89369 = r89366 * r89368;
        double r89370 = r89365 - r89369;
        double r89371 = r89361 * r89370;
        double r89372 = 1.2091207453430995e-70;
        bool r89373 = r89356 <= r89372;
        double r89374 = -r89356;
        double r89375 = r89356 * r89356;
        double r89376 = r89367 * r89363;
        double r89377 = r89360 * r89376;
        double r89378 = pow(r89377, r89359);
        double r89379 = r89375 - r89378;
        double r89380 = sqrt(r89379);
        double r89381 = r89374 + r89380;
        double r89382 = r89381 / r89360;
        double r89383 = r89382 / r89367;
        double r89384 = -0.5;
        double r89385 = r89384 * r89364;
        double r89386 = r89373 ? r89383 : r89385;
        double r89387 = r89358 ? r89371 : r89386;
        return r89387;
}

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 3 regimes
  2. if b < -1.0187622836227104e+102

    1. Initial program 46.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 pow146.9

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

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

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

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

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

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

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

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

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

    if -1.0187622836227104e+102 < b < 1.2091207453430995e-70

    1. Initial program 13.4

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

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

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

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

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

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

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

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

    if 1.2091207453430995e-70 < b

    1. Initial program 53.7

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le -1.018762283622710426864404427574628112872 \cdot 10^{102}:\\ \;\;\;\;\frac{1}{3} \cdot \left(1.5 \cdot \frac{c}{b} - 2 \cdot \frac{b}{a}\right)\\ \mathbf{elif}\;b \le 1.209120745343099452134664059704875392955 \cdot 10^{-70}:\\ \;\;\;\;\frac{\frac{\left(-b\right) + \sqrt{b \cdot b - {\left(3 \cdot \left(a \cdot c\right)\right)}^{1}}}{3}}{a}\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{c}{b}\\ \end{array}\]

Reproduce

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