Average Error: 33.9 → 9.1
Time: 4.8s
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.1259751240381662 \cdot 10^{137}:\\ \;\;\;\;1 \cdot \left(0.5 \cdot \frac{c}{b} - 0.66666666666666663 \cdot \frac{b}{a}\right)\\ \mathbf{elif}\;b \le 4.65690860885773435 \cdot 10^{-153}:\\ \;\;\;\;1 \cdot \frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\\ \mathbf{elif}\;b \le 31296389.2947799377:\\ \;\;\;\;1 \cdot \left(\frac{\frac{\left({b}^{2} - {b}^{2}\right) + 3 \cdot \left(a \cdot c\right)}{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}}{3} \cdot \frac{1}{a}\right)\\ \mathbf{else}:\\ \;\;\;\;1 \cdot \left(-0.5 \cdot \frac{c}{b}\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.1259751240381662 \cdot 10^{137}:\\
\;\;\;\;1 \cdot \left(0.5 \cdot \frac{c}{b} - 0.66666666666666663 \cdot \frac{b}{a}\right)\\

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

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

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

\end{array}
double f(double a, double b, double c) {
        double r131231 = b;
        double r131232 = -r131231;
        double r131233 = r131231 * r131231;
        double r131234 = 3.0;
        double r131235 = a;
        double r131236 = r131234 * r131235;
        double r131237 = c;
        double r131238 = r131236 * r131237;
        double r131239 = r131233 - r131238;
        double r131240 = sqrt(r131239);
        double r131241 = r131232 + r131240;
        double r131242 = r131241 / r131236;
        return r131242;
}

double f(double a, double b, double c) {
        double r131243 = b;
        double r131244 = -1.1259751240381662e+137;
        bool r131245 = r131243 <= r131244;
        double r131246 = 1.0;
        double r131247 = 0.5;
        double r131248 = c;
        double r131249 = r131248 / r131243;
        double r131250 = r131247 * r131249;
        double r131251 = 0.6666666666666666;
        double r131252 = a;
        double r131253 = r131243 / r131252;
        double r131254 = r131251 * r131253;
        double r131255 = r131250 - r131254;
        double r131256 = r131246 * r131255;
        double r131257 = 4.6569086088577344e-153;
        bool r131258 = r131243 <= r131257;
        double r131259 = -r131243;
        double r131260 = r131243 * r131243;
        double r131261 = 3.0;
        double r131262 = r131261 * r131252;
        double r131263 = r131262 * r131248;
        double r131264 = r131260 - r131263;
        double r131265 = sqrt(r131264);
        double r131266 = r131259 + r131265;
        double r131267 = r131266 / r131262;
        double r131268 = r131246 * r131267;
        double r131269 = 31296389.294779938;
        bool r131270 = r131243 <= r131269;
        double r131271 = 2.0;
        double r131272 = pow(r131243, r131271);
        double r131273 = r131272 - r131272;
        double r131274 = r131252 * r131248;
        double r131275 = r131261 * r131274;
        double r131276 = r131273 + r131275;
        double r131277 = r131259 - r131265;
        double r131278 = r131276 / r131277;
        double r131279 = r131278 / r131261;
        double r131280 = r131246 / r131252;
        double r131281 = r131279 * r131280;
        double r131282 = r131246 * r131281;
        double r131283 = -0.5;
        double r131284 = r131283 * r131249;
        double r131285 = r131246 * r131284;
        double r131286 = r131270 ? r131282 : r131285;
        double r131287 = r131258 ? r131268 : r131286;
        double r131288 = r131245 ? r131256 : r131287;
        return r131288;
}

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.1259751240381662e+137

    1. Initial program 56.5

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
    2. Using strategy rm
    3. Applied *-un-lft-identity56.5

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

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

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

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

    if -1.1259751240381662e+137 < b < 4.6569086088577344e-153

    1. Initial program 10.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 *-un-lft-identity10.9

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

    if 4.6569086088577344e-153 < b < 31296389.294779938

    1. Initial program 33.0

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
    2. Using strategy rm
    3. Applied *-un-lft-identity33.0

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

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

      \[\leadsto 1 \cdot \color{blue}{\left(\frac{1}{3} \cdot \frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{a}\right)}\]
    7. Using strategy rm
    8. Applied div-inv33.1

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

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

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

      \[\leadsto 1 \cdot \left(\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 \frac{1}{a}\right)\]
    13. Simplified17.2

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

    if 31296389.294779938 < b

    1. Initial program 55.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 *-un-lft-identity55.9

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le -1.1259751240381662 \cdot 10^{137}:\\ \;\;\;\;1 \cdot \left(0.5 \cdot \frac{c}{b} - 0.66666666666666663 \cdot \frac{b}{a}\right)\\ \mathbf{elif}\;b \le 4.65690860885773435 \cdot 10^{-153}:\\ \;\;\;\;1 \cdot \frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\\ \mathbf{elif}\;b \le 31296389.2947799377:\\ \;\;\;\;1 \cdot \left(\frac{\frac{\left({b}^{2} - {b}^{2}\right) + 3 \cdot \left(a \cdot c\right)}{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}}{3} \cdot \frac{1}{a}\right)\\ \mathbf{else}:\\ \;\;\;\;1 \cdot \left(-0.5 \cdot \frac{c}{b}\right)\\ \end{array}\]

Reproduce

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