Average Error: 33.9 → 7.5
Time: 15.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 -4.91962817906715367126033645969528543778 \cdot 10^{153}:\\ \;\;\;\;0.5 \cdot \frac{c}{b} - 0.6666666666666666296592325124947819858789 \cdot \frac{b}{a}\\ \mathbf{elif}\;b \le -5.426507427749237535624587160407326811487 \cdot 10^{-260}:\\ \;\;\;\;\frac{\frac{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} - b}{3}}{a}\\ \mathbf{elif}\;b \le 929319867835151.5:\\ \;\;\;\;\frac{c}{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}\\ \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 -4.91962817906715367126033645969528543778 \cdot 10^{153}:\\
\;\;\;\;0.5 \cdot \frac{c}{b} - 0.6666666666666666296592325124947819858789 \cdot \frac{b}{a}\\

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

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

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

\end{array}
double f(double a, double b, double c) {
        double r85862 = b;
        double r85863 = -r85862;
        double r85864 = r85862 * r85862;
        double r85865 = 3.0;
        double r85866 = a;
        double r85867 = r85865 * r85866;
        double r85868 = c;
        double r85869 = r85867 * r85868;
        double r85870 = r85864 - r85869;
        double r85871 = sqrt(r85870);
        double r85872 = r85863 + r85871;
        double r85873 = r85872 / r85867;
        return r85873;
}

double f(double a, double b, double c) {
        double r85874 = b;
        double r85875 = -4.919628179067154e+153;
        bool r85876 = r85874 <= r85875;
        double r85877 = 0.5;
        double r85878 = c;
        double r85879 = r85878 / r85874;
        double r85880 = r85877 * r85879;
        double r85881 = 0.6666666666666666;
        double r85882 = a;
        double r85883 = r85874 / r85882;
        double r85884 = r85881 * r85883;
        double r85885 = r85880 - r85884;
        double r85886 = -5.4265074277492375e-260;
        bool r85887 = r85874 <= r85886;
        double r85888 = r85874 * r85874;
        double r85889 = 3.0;
        double r85890 = r85889 * r85882;
        double r85891 = r85890 * r85878;
        double r85892 = r85888 - r85891;
        double r85893 = sqrt(r85892);
        double r85894 = r85893 - r85874;
        double r85895 = r85894 / r85889;
        double r85896 = r85895 / r85882;
        double r85897 = 929319867835151.5;
        bool r85898 = r85874 <= r85897;
        double r85899 = -r85874;
        double r85900 = r85899 - r85893;
        double r85901 = r85878 / r85900;
        double r85902 = -0.5;
        double r85903 = r85902 * r85879;
        double r85904 = r85898 ? r85901 : r85903;
        double r85905 = r85887 ? r85896 : r85904;
        double r85906 = r85876 ? r85885 : r85905;
        return r85906;
}

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 < -4.919628179067154e+153

    1. Initial program 63.8

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

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

    if -4.919628179067154e+153 < b < -5.4265074277492375e-260

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

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

    if -5.4265074277492375e-260 < b < 929319867835151.5

    1. Initial program 26.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-+26.5

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

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

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

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

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

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

      \[\leadsto \frac{\frac{\frac{c \cdot a}{1}}{\color{blue}{1 \cdot \left(\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right)}}}{a}\]
    13. Applied add-sqr-sqrt17.6

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

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

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

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

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

    if 929319867835151.5 < b

    1. Initial program 56.2

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le -4.91962817906715367126033645969528543778 \cdot 10^{153}:\\ \;\;\;\;0.5 \cdot \frac{c}{b} - 0.6666666666666666296592325124947819858789 \cdot \frac{b}{a}\\ \mathbf{elif}\;b \le -5.426507427749237535624587160407326811487 \cdot 10^{-260}:\\ \;\;\;\;\frac{\frac{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} - b}{3}}{a}\\ \mathbf{elif}\;b \le 929319867835151.5:\\ \;\;\;\;\frac{c}{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{c}{b}\\ \end{array}\]

Reproduce

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