Average Error: 34.5 → 10.3
Time: 17.2s
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.763315479739403460017265344144602342789 \cdot 10^{89}:\\ \;\;\;\;0.5 \cdot \frac{c}{b} - \frac{b}{a} \cdot 0.6666666666666666296592325124947819858789\\ \mathbf{elif}\;b \le 9.136492990928292133394320076175633285536 \cdot 10^{-23}:\\ \;\;\;\;\frac{\frac{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} - b}{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.763315479739403460017265344144602342789 \cdot 10^{89}:\\
\;\;\;\;0.5 \cdot \frac{c}{b} - \frac{b}{a} \cdot 0.6666666666666666296592325124947819858789\\

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

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

\end{array}
double f(double a, double b, double c) {
        double r3832282 = b;
        double r3832283 = -r3832282;
        double r3832284 = r3832282 * r3832282;
        double r3832285 = 3.0;
        double r3832286 = a;
        double r3832287 = r3832285 * r3832286;
        double r3832288 = c;
        double r3832289 = r3832287 * r3832288;
        double r3832290 = r3832284 - r3832289;
        double r3832291 = sqrt(r3832290);
        double r3832292 = r3832283 + r3832291;
        double r3832293 = r3832292 / r3832287;
        return r3832293;
}

double f(double a, double b, double c) {
        double r3832294 = b;
        double r3832295 = -1.7633154797394035e+89;
        bool r3832296 = r3832294 <= r3832295;
        double r3832297 = 0.5;
        double r3832298 = c;
        double r3832299 = r3832298 / r3832294;
        double r3832300 = r3832297 * r3832299;
        double r3832301 = a;
        double r3832302 = r3832294 / r3832301;
        double r3832303 = 0.6666666666666666;
        double r3832304 = r3832302 * r3832303;
        double r3832305 = r3832300 - r3832304;
        double r3832306 = 9.136492990928292e-23;
        bool r3832307 = r3832294 <= r3832306;
        double r3832308 = r3832294 * r3832294;
        double r3832309 = 3.0;
        double r3832310 = r3832309 * r3832301;
        double r3832311 = r3832310 * r3832298;
        double r3832312 = r3832308 - r3832311;
        double r3832313 = sqrt(r3832312);
        double r3832314 = r3832313 - r3832294;
        double r3832315 = r3832314 / r3832309;
        double r3832316 = r3832315 / r3832301;
        double r3832317 = -0.5;
        double r3832318 = r3832317 * r3832299;
        double r3832319 = r3832307 ? r3832316 : r3832318;
        double r3832320 = r3832296 ? r3832305 : r3832319;
        return r3832320;
}

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.7633154797394035e+89

    1. Initial program 45.8

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

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

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

    if -1.7633154797394035e+89 < b < 9.136492990928292e-23

    1. Initial program 15.1

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

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

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

    if 9.136492990928292e-23 < b

    1. Initial program 55.4

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le -1.763315479739403460017265344144602342789 \cdot 10^{89}:\\ \;\;\;\;0.5 \cdot \frac{c}{b} - \frac{b}{a} \cdot 0.6666666666666666296592325124947819858789\\ \mathbf{elif}\;b \le 9.136492990928292133394320076175633285536 \cdot 10^{-23}:\\ \;\;\;\;\frac{\frac{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} - b}{3}}{a}\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{c}{b}\\ \end{array}\]

Reproduce

herbie shell --seed 2019172 
(FPCore (a b c)
  :name "Cubic critical"
  (/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))