Average Error: 34.3 → 10.7
Time: 10.1s
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 -8.55528137777049654 \cdot 10^{140}:\\ \;\;\;\;0.5 \cdot \frac{c}{b} - 0.66666666666666663 \cdot \frac{b}{a}\\ \mathbf{elif}\;b \le 11181767625882.1309:\\ \;\;\;\;\frac{1}{\frac{3 \cdot a}{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} - b}}\\ \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 -8.55528137777049654 \cdot 10^{140}:\\
\;\;\;\;0.5 \cdot \frac{c}{b} - 0.66666666666666663 \cdot \frac{b}{a}\\

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

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

\end{array}
double f(double a, double b, double c) {
        double r103901 = b;
        double r103902 = -r103901;
        double r103903 = r103901 * r103901;
        double r103904 = 3.0;
        double r103905 = a;
        double r103906 = r103904 * r103905;
        double r103907 = c;
        double r103908 = r103906 * r103907;
        double r103909 = r103903 - r103908;
        double r103910 = sqrt(r103909);
        double r103911 = r103902 + r103910;
        double r103912 = r103911 / r103906;
        return r103912;
}

double f(double a, double b, double c) {
        double r103913 = b;
        double r103914 = -8.555281377770497e+140;
        bool r103915 = r103913 <= r103914;
        double r103916 = 0.5;
        double r103917 = c;
        double r103918 = r103917 / r103913;
        double r103919 = r103916 * r103918;
        double r103920 = 0.6666666666666666;
        double r103921 = a;
        double r103922 = r103913 / r103921;
        double r103923 = r103920 * r103922;
        double r103924 = r103919 - r103923;
        double r103925 = 11181767625882.13;
        bool r103926 = r103913 <= r103925;
        double r103927 = 1.0;
        double r103928 = 3.0;
        double r103929 = r103928 * r103921;
        double r103930 = r103913 * r103913;
        double r103931 = r103929 * r103917;
        double r103932 = r103930 - r103931;
        double r103933 = sqrt(r103932);
        double r103934 = r103933 - r103913;
        double r103935 = r103929 / r103934;
        double r103936 = r103927 / r103935;
        double r103937 = -0.5;
        double r103938 = r103937 * r103918;
        double r103939 = r103926 ? r103936 : r103938;
        double r103940 = r103915 ? r103924 : r103939;
        return r103940;
}

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 3 regimes
  2. if b < -8.555281377770497e+140

    1. Initial program 58.5

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

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

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

    if -8.555281377770497e+140 < b < 11181767625882.13

    1. Initial program 15.8

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

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

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

    if 11181767625882.13 < b

    1. Initial program 56.0

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le -8.55528137777049654 \cdot 10^{140}:\\ \;\;\;\;0.5 \cdot \frac{c}{b} - 0.66666666666666663 \cdot \frac{b}{a}\\ \mathbf{elif}\;b \le 11181767625882.1309:\\ \;\;\;\;\frac{1}{\frac{3 \cdot a}{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} - b}}\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{c}{b}\\ \end{array}\]

Reproduce

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