\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\begin{array}{l}
\mathbf{if}\;b \leq -1.346889012582839 \cdot 10^{+154}:\\
\;\;\;\;\frac{\frac{\sqrt{0} - b}{3}}{a}\\
\mathbf{elif}\;b \leq -2.7798465605045782 \cdot 10^{-285}:\\
\;\;\;\;\frac{1}{\frac{3}{\frac{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} - b}{a}}}\\
\mathbf{else}:\\
\;\;\;\;-\frac{c}{b + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}\\
\end{array}(FPCore (a b c) :precision binary64 (/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))
(FPCore (a b c)
:precision binary64
(if (<= b -1.346889012582839e+154)
(/ (/ (- (sqrt 0.0) b) 3.0) a)
(if (<= b -2.7798465605045782e-285)
(/ 1.0 (/ 3.0 (/ (- (sqrt (- (* b b) (* (* 3.0 a) c))) b) a)))
(- (/ c (+ b (sqrt (- (* b b) (* (* 3.0 a) c)))))))))double code(double a, double b, double c) {
return (-b + sqrt((b * b) - ((3.0 * a) * c))) / (3.0 * a);
}
double code(double a, double b, double c) {
double tmp;
if (b <= -1.346889012582839e+154) {
tmp = ((sqrt(0.0) - b) / 3.0) / a;
} else if (b <= -2.7798465605045782e-285) {
tmp = 1.0 / (3.0 / ((sqrt((b * b) - ((3.0 * a) * c)) - b) / a));
} else {
tmp = -(c / (b + sqrt((b * b) - ((3.0 * a) * c))));
}
return tmp;
}



Bits error versus a



Bits error versus b



Bits error versus c
Results
if b < -1.34688901258283899e154Initial program 64.0
Simplified64.0
rmApplied associate-/r*_binary6464.0
Taylor expanded around inf 52.2
if -1.34688901258283899e154 < b < -2.77984656050457822e-285Initial program 8.5
Simplified8.5
rmApplied clear-num_binary648.6
Simplified8.6
if -2.77984656050457822e-285 < b Initial program 43.5
Simplified43.5
rmApplied associate-/r*_binary6443.5
rmApplied flip--_binary6443.5
Simplified23.3
Simplified23.3
rmApplied *-un-lft-identity_binary6423.3
Applied associate-/r*_binary6423.3
Simplified21.8
rmApplied distribute-lft-neg-out_binary6421.8
Applied distribute-frac-neg_binary6421.8
Simplified17.9
Final simplification18.5
herbie shell --seed 2020268
(FPCore (a b c)
:name "Cubic critical"
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))