Average Error: 34.3 → 10.7
Time: 10.2s
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 r105080 = b;
        double r105081 = -r105080;
        double r105082 = r105080 * r105080;
        double r105083 = 3.0;
        double r105084 = a;
        double r105085 = r105083 * r105084;
        double r105086 = c;
        double r105087 = r105085 * r105086;
        double r105088 = r105082 - r105087;
        double r105089 = sqrt(r105088);
        double r105090 = r105081 + r105089;
        double r105091 = r105090 / r105085;
        return r105091;
}

double f(double a, double b, double c) {
        double r105092 = b;
        double r105093 = -8.555281377770497e+140;
        bool r105094 = r105092 <= r105093;
        double r105095 = 0.5;
        double r105096 = c;
        double r105097 = r105096 / r105092;
        double r105098 = r105095 * r105097;
        double r105099 = 0.6666666666666666;
        double r105100 = a;
        double r105101 = r105092 / r105100;
        double r105102 = r105099 * r105101;
        double r105103 = r105098 - r105102;
        double r105104 = 11181767625882.13;
        bool r105105 = r105092 <= r105104;
        double r105106 = 1.0;
        double r105107 = 3.0;
        double r105108 = r105107 * r105100;
        double r105109 = r105092 * r105092;
        double r105110 = r105108 * r105096;
        double r105111 = r105109 - r105110;
        double r105112 = sqrt(r105111);
        double r105113 = r105112 - r105092;
        double r105114 = r105108 / r105113;
        double r105115 = r105106 / r105114;
        double r105116 = -0.5;
        double r105117 = r105116 * r105097;
        double r105118 = r105105 ? r105115 : r105117;
        double r105119 = r105094 ? r105103 : r105118;
        return r105119;
}

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