Average Error: 34.5 → 8.4
Time: 5.5s
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 -5.7374865731430188 \cdot 10^{150}:\\ \;\;\;\;0.5 \cdot \frac{c}{b} - 0.66666666666666663 \cdot \frac{b}{a}\\ \mathbf{elif}\;b \le -6.34779295965058579 \cdot 10^{-260}:\\ \;\;\;\;\frac{\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3}}{a}\\ \mathbf{elif}\;b \le 3.94727955799334207 \cdot 10^{70}:\\ \;\;\;\;\frac{1 \cdot \frac{3}{\frac{\frac{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{a}}{c}}}{3 \cdot a}\\ \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 -5.7374865731430188 \cdot 10^{150}:\\
\;\;\;\;0.5 \cdot \frac{c}{b} - 0.66666666666666663 \cdot \frac{b}{a}\\

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

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

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

\end{array}
double f(double a, double b, double c) {
        double r107202 = b;
        double r107203 = -r107202;
        double r107204 = r107202 * r107202;
        double r107205 = 3.0;
        double r107206 = a;
        double r107207 = r107205 * r107206;
        double r107208 = c;
        double r107209 = r107207 * r107208;
        double r107210 = r107204 - r107209;
        double r107211 = sqrt(r107210);
        double r107212 = r107203 + r107211;
        double r107213 = r107212 / r107207;
        return r107213;
}

double f(double a, double b, double c) {
        double r107214 = b;
        double r107215 = -5.737486573143019e+150;
        bool r107216 = r107214 <= r107215;
        double r107217 = 0.5;
        double r107218 = c;
        double r107219 = r107218 / r107214;
        double r107220 = r107217 * r107219;
        double r107221 = 0.6666666666666666;
        double r107222 = a;
        double r107223 = r107214 / r107222;
        double r107224 = r107221 * r107223;
        double r107225 = r107220 - r107224;
        double r107226 = -6.347792959650586e-260;
        bool r107227 = r107214 <= r107226;
        double r107228 = -r107214;
        double r107229 = r107214 * r107214;
        double r107230 = 3.0;
        double r107231 = r107230 * r107222;
        double r107232 = r107231 * r107218;
        double r107233 = r107229 - r107232;
        double r107234 = sqrt(r107233);
        double r107235 = r107228 + r107234;
        double r107236 = r107235 / r107230;
        double r107237 = r107236 / r107222;
        double r107238 = 3.947279557993342e+70;
        bool r107239 = r107214 <= r107238;
        double r107240 = 1.0;
        double r107241 = r107228 - r107234;
        double r107242 = r107241 / r107222;
        double r107243 = r107242 / r107218;
        double r107244 = r107230 / r107243;
        double r107245 = r107240 * r107244;
        double r107246 = r107245 / r107231;
        double r107247 = -0.5;
        double r107248 = r107247 * r107219;
        double r107249 = r107239 ? r107246 : r107248;
        double r107250 = r107227 ? r107237 : r107249;
        double r107251 = r107216 ? r107225 : r107250;
        return r107251;
}

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 < -5.737486573143019e+150

    1. Initial program 62.5

      \[\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.66666666666666663 \cdot \frac{b}{a}}\]

    if -5.737486573143019e+150 < b < -6.347792959650586e-260

    1. Initial program 8.3

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
    2. Using strategy rm
    3. Applied associate-/r*8.3

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

    if -6.347792959650586e-260 < b < 3.947279557993342e+70

    1. Initial program 29.3

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

      \[\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 + 3 \cdot \left(a \cdot c\right)}}{\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 + 3 \cdot \left(a \cdot c\right)}{\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 + 3 \cdot \left(a \cdot c\right)\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 + 3 \cdot \left(a \cdot c\right)}{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}}}{3 \cdot a}\]
    9. Simplified16.4

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

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

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

    if 3.947279557993342e+70 < b

    1. Initial program 58.7

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le -5.7374865731430188 \cdot 10^{150}:\\ \;\;\;\;0.5 \cdot \frac{c}{b} - 0.66666666666666663 \cdot \frac{b}{a}\\ \mathbf{elif}\;b \le -6.34779295965058579 \cdot 10^{-260}:\\ \;\;\;\;\frac{\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3}}{a}\\ \mathbf{elif}\;b \le 3.94727955799334207 \cdot 10^{70}:\\ \;\;\;\;\frac{1 \cdot \frac{3}{\frac{\frac{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{a}}{c}}}{3 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{c}{b}\\ \end{array}\]

Reproduce

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