Average Error: 34.2 → 9.8
Time: 26.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.139975678520567663603045399522192354667 \cdot 10^{154}:\\ \;\;\;\;\frac{\frac{1.5 \cdot \frac{a \cdot c}{b} - 2 \cdot b}{3}}{a}\\ \mathbf{elif}\;b \le -2.214640747245634010207767966958415488931 \cdot 10^{-234}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\\ \mathbf{elif}\;b \le 1.637981871922542116970186679587044653306 \cdot 10^{152}:\\ \;\;\;\;\frac{-1}{\frac{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} + b}{c} \cdot \frac{a}{a}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\frac{-\left(3 \cdot a\right) \cdot c}{\left(b - 1.5 \cdot \frac{a \cdot c}{b}\right) + b}}{3}}{a}\\ \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.139975678520567663603045399522192354667 \cdot 10^{154}:\\
\;\;\;\;\frac{\frac{1.5 \cdot \frac{a \cdot c}{b} - 2 \cdot b}{3}}{a}\\

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

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

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

\end{array}
double f(double a, double b, double c) {
        double r111345 = b;
        double r111346 = -r111345;
        double r111347 = r111345 * r111345;
        double r111348 = 3.0;
        double r111349 = a;
        double r111350 = r111348 * r111349;
        double r111351 = c;
        double r111352 = r111350 * r111351;
        double r111353 = r111347 - r111352;
        double r111354 = sqrt(r111353);
        double r111355 = r111346 + r111354;
        double r111356 = r111355 / r111350;
        return r111356;
}

double f(double a, double b, double c) {
        double r111357 = b;
        double r111358 = -1.1399756785205677e+154;
        bool r111359 = r111357 <= r111358;
        double r111360 = 1.5;
        double r111361 = a;
        double r111362 = c;
        double r111363 = r111361 * r111362;
        double r111364 = r111363 / r111357;
        double r111365 = r111360 * r111364;
        double r111366 = 2.0;
        double r111367 = r111366 * r111357;
        double r111368 = r111365 - r111367;
        double r111369 = 3.0;
        double r111370 = r111368 / r111369;
        double r111371 = r111370 / r111361;
        double r111372 = -2.214640747245634e-234;
        bool r111373 = r111357 <= r111372;
        double r111374 = -r111357;
        double r111375 = r111357 * r111357;
        double r111376 = r111369 * r111361;
        double r111377 = r111376 * r111362;
        double r111378 = r111375 - r111377;
        double r111379 = sqrt(r111378);
        double r111380 = r111374 + r111379;
        double r111381 = r111380 / r111376;
        double r111382 = 1.6379818719225421e+152;
        bool r111383 = r111357 <= r111382;
        double r111384 = -1.0;
        double r111385 = r111379 + r111357;
        double r111386 = r111385 / r111362;
        double r111387 = r111361 / r111361;
        double r111388 = r111386 * r111387;
        double r111389 = r111384 / r111388;
        double r111390 = -r111377;
        double r111391 = r111357 - r111365;
        double r111392 = r111391 + r111357;
        double r111393 = r111390 / r111392;
        double r111394 = r111393 / r111369;
        double r111395 = r111394 / r111361;
        double r111396 = r111383 ? r111389 : r111395;
        double r111397 = r111373 ? r111381 : r111396;
        double r111398 = r111359 ? r111371 : r111397;
        return r111398;
}

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.1399756785205677e+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. Simplified64.0

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

      \[\leadsto \frac{\frac{\color{blue}{1.5 \cdot \frac{a \cdot c}{b} - 2 \cdot b}}{3}}{a}\]

    if -1.1399756785205677e+154 < b < -2.214640747245634e-234

    1. Initial program 7.2

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

    if -2.214640747245634e-234 < b < 1.6379818719225421e+152

    1. Initial program 32.5

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

      \[\leadsto \color{blue}{\frac{\frac{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} - b}{3}}{a}}\]
    3. Using strategy rm
    4. Applied flip--32.7

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

      \[\leadsto \frac{\frac{\frac{\color{blue}{0 - \left(3 \cdot a\right) \cdot c}}{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} + b}}{3}}{a}\]
    6. Using strategy rm
    7. Applied sub0-neg16.2

      \[\leadsto \frac{\frac{\frac{\color{blue}{-\left(3 \cdot a\right) \cdot c}}{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} + b}}{3}}{a}\]
    8. Applied distribute-frac-neg16.2

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

      \[\leadsto \frac{\frac{-\color{blue}{\frac{a \cdot 3}{\frac{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} + b}{c}}}}{3}}{a}\]
    10. Using strategy rm
    11. Applied div-inv14.6

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

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

      \[\leadsto \frac{-\frac{a \cdot 3}{\frac{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} + b}{c}}}{\color{blue}{3 \cdot a}}\]
    14. Using strategy rm
    15. Applied *-un-lft-identity14.4

      \[\leadsto \frac{-\color{blue}{1 \cdot \frac{a \cdot 3}{\frac{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} + b}{c}}}}{3 \cdot a}\]
    16. Applied distribute-lft-neg-in14.4

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

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

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

    if 1.6379818719225421e+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. Simplified63.8

      \[\leadsto \color{blue}{\frac{\frac{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} - b}{3}}{a}}\]
    3. Using strategy rm
    4. Applied flip--63.8

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

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

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

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

Reproduce

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