Average Error: 33.9 → 7.1
Time: 17.9s
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.594947000714855189120603839967237527365 \cdot 10^{98}:\\ \;\;\;\;0.5 \cdot \frac{c}{b} - 0.6666666666666666296592325124947819858789 \cdot \frac{b}{a}\\ \mathbf{elif}\;b \le -2.312272680827216451791881279954599486801 \cdot 10^{-225}:\\ \;\;\;\;\frac{\frac{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} - b}{3}}{a}\\ \mathbf{elif}\;b \le 2.269665110513950885787223322334260534415 \cdot 10^{61}:\\ \;\;\;\;\frac{1}{\frac{3}{c \cdot 3} \cdot \left(\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right)}\\ \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.594947000714855189120603839967237527365 \cdot 10^{98}:\\
\;\;\;\;0.5 \cdot \frac{c}{b} - 0.6666666666666666296592325124947819858789 \cdot \frac{b}{a}\\

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

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

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

\end{array}
double f(double a, double b, double c) {
        double r110339 = b;
        double r110340 = -r110339;
        double r110341 = r110339 * r110339;
        double r110342 = 3.0;
        double r110343 = a;
        double r110344 = r110342 * r110343;
        double r110345 = c;
        double r110346 = r110344 * r110345;
        double r110347 = r110341 - r110346;
        double r110348 = sqrt(r110347);
        double r110349 = r110340 + r110348;
        double r110350 = r110349 / r110344;
        return r110350;
}

double f(double a, double b, double c) {
        double r110351 = b;
        double r110352 = -8.594947000714855e+98;
        bool r110353 = r110351 <= r110352;
        double r110354 = 0.5;
        double r110355 = c;
        double r110356 = r110355 / r110351;
        double r110357 = r110354 * r110356;
        double r110358 = 0.6666666666666666;
        double r110359 = a;
        double r110360 = r110351 / r110359;
        double r110361 = r110358 * r110360;
        double r110362 = r110357 - r110361;
        double r110363 = -2.3122726808272165e-225;
        bool r110364 = r110351 <= r110363;
        double r110365 = r110351 * r110351;
        double r110366 = 3.0;
        double r110367 = r110366 * r110359;
        double r110368 = r110367 * r110355;
        double r110369 = r110365 - r110368;
        double r110370 = sqrt(r110369);
        double r110371 = r110370 - r110351;
        double r110372 = r110371 / r110366;
        double r110373 = r110372 / r110359;
        double r110374 = 2.269665110513951e+61;
        bool r110375 = r110351 <= r110374;
        double r110376 = 1.0;
        double r110377 = r110355 * r110366;
        double r110378 = r110366 / r110377;
        double r110379 = -r110351;
        double r110380 = r110379 - r110370;
        double r110381 = r110378 * r110380;
        double r110382 = r110376 / r110381;
        double r110383 = -0.5;
        double r110384 = r110383 * r110356;
        double r110385 = r110375 ? r110382 : r110384;
        double r110386 = r110364 ? r110373 : r110385;
        double r110387 = r110353 ? r110362 : r110386;
        return r110387;
}

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.594947000714855e+98

    1. Initial program 46.3

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

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

    if -8.594947000714855e+98 < b < -2.3122726808272165e-225

    1. Initial program 8.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 associate-/r*8.2

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

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

    if -2.3122726808272165e-225 < b < 2.269665110513951e+61

    1. Initial program 27.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 flip-+27.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.2

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

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

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

      \[\leadsto \frac{\color{blue}{\frac{1}{1} \cdot \frac{0 + \left(c \cdot 3\right) \cdot a}{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}}}{3 \cdot a}\]
    9. Applied associate-/l*16.3

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

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

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

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

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

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

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

    if 2.269665110513951e+61 < b

    1. Initial program 57.4

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le -8.594947000714855189120603839967237527365 \cdot 10^{98}:\\ \;\;\;\;0.5 \cdot \frac{c}{b} - 0.6666666666666666296592325124947819858789 \cdot \frac{b}{a}\\ \mathbf{elif}\;b \le -2.312272680827216451791881279954599486801 \cdot 10^{-225}:\\ \;\;\;\;\frac{\frac{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} - b}{3}}{a}\\ \mathbf{elif}\;b \le 2.269665110513950885787223322334260534415 \cdot 10^{61}:\\ \;\;\;\;\frac{1}{\frac{3}{c \cdot 3} \cdot \left(\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right)}\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{c}{b}\\ \end{array}\]

Reproduce

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