Average Error: 33.8 → 7.9
Time: 20.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.347608436307838173759579035400211655706 \cdot 10^{126}:\\ \;\;\;\;\frac{\frac{a \cdot 1.5}{\frac{b}{c}} + -2 \cdot b}{3 \cdot a}\\ \mathbf{elif}\;b \le -1.917293071139976296336083936745225751817 \cdot 10^{-308}:\\ \;\;\;\;\frac{\frac{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} - b}{a}}{3}\\ \mathbf{elif}\;b \le 3.628799960716311990444092539387346352569 \cdot 10^{50}:\\ \;\;\;\;c \cdot \frac{1}{-\left(b + \sqrt{b \cdot b - \left(3 \cdot c\right) \cdot a}\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\frac{1}{\frac{1}{3}}}{\frac{3}{c}}}{-\left(b \cdot 2 - 1.5 \cdot \frac{c \cdot a}{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.347608436307838173759579035400211655706 \cdot 10^{126}:\\
\;\;\;\;\frac{\frac{a \cdot 1.5}{\frac{b}{c}} + -2 \cdot b}{3 \cdot a}\\

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

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

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

\end{array}
double f(double a, double b, double c) {
        double r109216 = b;
        double r109217 = -r109216;
        double r109218 = r109216 * r109216;
        double r109219 = 3.0;
        double r109220 = a;
        double r109221 = r109219 * r109220;
        double r109222 = c;
        double r109223 = r109221 * r109222;
        double r109224 = r109218 - r109223;
        double r109225 = sqrt(r109224);
        double r109226 = r109217 + r109225;
        double r109227 = r109226 / r109221;
        return r109227;
}

double f(double a, double b, double c) {
        double r109228 = b;
        double r109229 = -1.3476084363078382e+126;
        bool r109230 = r109228 <= r109229;
        double r109231 = a;
        double r109232 = 1.5;
        double r109233 = r109231 * r109232;
        double r109234 = c;
        double r109235 = r109228 / r109234;
        double r109236 = r109233 / r109235;
        double r109237 = -2.0;
        double r109238 = r109237 * r109228;
        double r109239 = r109236 + r109238;
        double r109240 = 3.0;
        double r109241 = r109240 * r109231;
        double r109242 = r109239 / r109241;
        double r109243 = -1.9172930711399763e-308;
        bool r109244 = r109228 <= r109243;
        double r109245 = r109228 * r109228;
        double r109246 = r109241 * r109234;
        double r109247 = r109245 - r109246;
        double r109248 = sqrt(r109247);
        double r109249 = r109248 - r109228;
        double r109250 = r109249 / r109231;
        double r109251 = r109250 / r109240;
        double r109252 = 3.628799960716312e+50;
        bool r109253 = r109228 <= r109252;
        double r109254 = 1.0;
        double r109255 = r109240 * r109234;
        double r109256 = r109255 * r109231;
        double r109257 = r109245 - r109256;
        double r109258 = sqrt(r109257);
        double r109259 = r109228 + r109258;
        double r109260 = -r109259;
        double r109261 = r109254 / r109260;
        double r109262 = r109234 * r109261;
        double r109263 = r109254 / r109240;
        double r109264 = r109254 / r109263;
        double r109265 = r109240 / r109234;
        double r109266 = r109264 / r109265;
        double r109267 = 2.0;
        double r109268 = r109228 * r109267;
        double r109269 = r109234 * r109231;
        double r109270 = r109269 / r109228;
        double r109271 = r109232 * r109270;
        double r109272 = r109268 - r109271;
        double r109273 = -r109272;
        double r109274 = r109266 / r109273;
        double r109275 = r109253 ? r109262 : r109274;
        double r109276 = r109244 ? r109251 : r109275;
        double r109277 = r109230 ? r109242 : r109276;
        return r109277;
}

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.3476084363078382e+126

    1. Initial program 53.0

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

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

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

    if -1.3476084363078382e+126 < b < -1.9172930711399763e-308

    1. Initial program 8.7

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

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

    if -1.9172930711399763e-308 < b < 3.628799960716312e+50

    1. Initial program 30.7

      \[\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-+30.7

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

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

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

      \[\leadsto \frac{\frac{0 + c \cdot \left(a \cdot 3\right)}{\color{blue}{1 \cdot \left(\left(-b\right) - \sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)}\right)}}}{3 \cdot a}\]
    8. Applied *-un-lft-identity16.7

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

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

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

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

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

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

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

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

    if 3.628799960716312e+50 < b

    1. Initial program 56.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 flip-+56.9

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{1}{1} \cdot \frac{\frac{\frac{1}{\frac{1}{3}}}{\frac{3}{c}}}{-\color{blue}{\left(2 \cdot b - \frac{c \cdot a}{b} \cdot 1.5\right)}}\]
  3. Recombined 4 regimes into one program.
  4. Final simplification7.9

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le -1.347608436307838173759579035400211655706 \cdot 10^{126}:\\ \;\;\;\;\frac{\frac{a \cdot 1.5}{\frac{b}{c}} + -2 \cdot b}{3 \cdot a}\\ \mathbf{elif}\;b \le -1.917293071139976296336083936745225751817 \cdot 10^{-308}:\\ \;\;\;\;\frac{\frac{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} - b}{a}}{3}\\ \mathbf{elif}\;b \le 3.628799960716311990444092539387346352569 \cdot 10^{50}:\\ \;\;\;\;c \cdot \frac{1}{-\left(b + \sqrt{b \cdot b - \left(3 \cdot c\right) \cdot a}\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\frac{1}{\frac{1}{3}}}{\frac{3}{c}}}{-\left(b \cdot 2 - 1.5 \cdot \frac{c \cdot a}{b}\right)}\\ \end{array}\]

Reproduce

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