Average Error: 34.9 → 12.0
Time: 16.4s
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 -3.938820754703495889486844390187078997042 \cdot 10^{91}:\\ \;\;\;\;\frac{1.5 \cdot \frac{a \cdot c}{b} - 2 \cdot b}{3 \cdot a}\\ \mathbf{elif}\;b \le -5.602943297867931323560714007643516615344 \cdot 10^{-285}:\\ \;\;\;\;\frac{\frac{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} - b}{3}}{a}\\ \mathbf{elif}\;b \le 2.394453211650850018945717757577833039884 \cdot 10^{124}:\\ \;\;\;\;\frac{1}{3} \cdot \frac{a \cdot \left(c \cdot \frac{3}{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}\right)}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\left(a \cdot c\right) \cdot 3}{\left(-b\right) - \left(b - 1.5 \cdot \frac{a \cdot c}{b}\right)}}{3 \cdot 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 -3.938820754703495889486844390187078997042 \cdot 10^{91}:\\
\;\;\;\;\frac{1.5 \cdot \frac{a \cdot c}{b} - 2 \cdot b}{3 \cdot a}\\

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

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

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

\end{array}
double f(double a, double b, double c) {
        double r121862 = b;
        double r121863 = -r121862;
        double r121864 = r121862 * r121862;
        double r121865 = 3.0;
        double r121866 = a;
        double r121867 = r121865 * r121866;
        double r121868 = c;
        double r121869 = r121867 * r121868;
        double r121870 = r121864 - r121869;
        double r121871 = sqrt(r121870);
        double r121872 = r121863 + r121871;
        double r121873 = r121872 / r121867;
        return r121873;
}

double f(double a, double b, double c) {
        double r121874 = b;
        double r121875 = -3.938820754703496e+91;
        bool r121876 = r121874 <= r121875;
        double r121877 = 1.5;
        double r121878 = a;
        double r121879 = c;
        double r121880 = r121878 * r121879;
        double r121881 = r121880 / r121874;
        double r121882 = r121877 * r121881;
        double r121883 = 2.0;
        double r121884 = r121883 * r121874;
        double r121885 = r121882 - r121884;
        double r121886 = 3.0;
        double r121887 = r121886 * r121878;
        double r121888 = r121885 / r121887;
        double r121889 = -5.602943297867931e-285;
        bool r121890 = r121874 <= r121889;
        double r121891 = r121874 * r121874;
        double r121892 = r121887 * r121879;
        double r121893 = r121891 - r121892;
        double r121894 = sqrt(r121893);
        double r121895 = r121894 - r121874;
        double r121896 = r121895 / r121886;
        double r121897 = r121896 / r121878;
        double r121898 = 2.39445321165085e+124;
        bool r121899 = r121874 <= r121898;
        double r121900 = 1.0;
        double r121901 = r121900 / r121886;
        double r121902 = -r121874;
        double r121903 = r121902 - r121894;
        double r121904 = r121886 / r121903;
        double r121905 = r121879 * r121904;
        double r121906 = r121878 * r121905;
        double r121907 = r121906 / r121878;
        double r121908 = r121901 * r121907;
        double r121909 = r121880 * r121886;
        double r121910 = r121874 - r121882;
        double r121911 = r121902 - r121910;
        double r121912 = r121909 / r121911;
        double r121913 = r121912 / r121887;
        double r121914 = r121899 ? r121908 : r121913;
        double r121915 = r121890 ? r121897 : r121914;
        double r121916 = r121876 ? r121888 : r121915;
        return r121916;
}

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 < -3.938820754703496e+91

    1. Initial program 45.8

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

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

    if -3.938820754703496e+91 < b < -5.602943297867931e-285

    1. Initial program 9.3

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

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

    if -5.602943297867931e-285 < b < 2.39445321165085e+124

    1. Initial program 33.6

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

      \[\leadsto \frac{\frac{\color{blue}{0 + \left(a \cdot c\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 *-un-lft-identity16.4

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

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

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

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

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

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

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

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

      \[\leadsto \frac{1}{3} \cdot \frac{\color{blue}{\left(a \cdot c\right)} \cdot \frac{3}{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}}{a}\]
    16. Using strategy rm
    17. Applied associate-*l*14.5

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

    if 2.39445321165085e+124 < b

    1. Initial program 61.6

      \[\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-+61.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. Simplified33.6

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le -3.938820754703495889486844390187078997042 \cdot 10^{91}:\\ \;\;\;\;\frac{1.5 \cdot \frac{a \cdot c}{b} - 2 \cdot b}{3 \cdot a}\\ \mathbf{elif}\;b \le -5.602943297867931323560714007643516615344 \cdot 10^{-285}:\\ \;\;\;\;\frac{\frac{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} - b}{3}}{a}\\ \mathbf{elif}\;b \le 2.394453211650850018945717757577833039884 \cdot 10^{124}:\\ \;\;\;\;\frac{1}{3} \cdot \frac{a \cdot \left(c \cdot \frac{3}{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}\right)}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\left(a \cdot c\right) \cdot 3}{\left(-b\right) - \left(b - 1.5 \cdot \frac{a \cdot c}{b}\right)}}{3 \cdot a}\\ \end{array}\]

Reproduce

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