\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 -2.097183452461109 \cdot 10^{+149}:\\
\;\;\;\;0.5 \cdot \frac{c}{b} - 0.6666666666666666 \cdot \frac{b}{a}\\
\mathbf{elif}\;b \leq -4.704826106702257 \cdot 10^{-221}:\\
\;\;\;\;\frac{\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - b}{3}}{a}\\
\mathbf{elif}\;b \leq 2.217223282760919 \cdot 10^{+108}:\\
\;\;\;\;\frac{1}{\left(b + \sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)}\right) \cdot \frac{-1}{c}}\\
\mathbf{else}:\\
\;\;\;\;\frac{c}{b} \cdot -0.5\\
\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 -2.097183452461109e+149)
(- (* 0.5 (/ c b)) (* 0.6666666666666666 (/ b a)))
(if (<= b -4.704826106702257e-221)
(/ (/ (- (sqrt (- (* b b) (* c (* a 3.0)))) b) 3.0) a)
(if (<= b 2.217223282760919e+108)
(/ 1.0 (* (+ b (sqrt (- (* b b) (* c (* a 3.0))))) (/ -1.0 c)))
(* (/ c b) -0.5)))))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 <= -2.097183452461109e+149) {
tmp = (0.5 * (c / b)) - (0.6666666666666666 * (b / a));
} else if (b <= -4.704826106702257e-221) {
tmp = ((sqrt((b * b) - (c * (a * 3.0))) - b) / 3.0) / a;
} else if (b <= 2.217223282760919e+108) {
tmp = 1.0 / ((b + sqrt((b * b) - (c * (a * 3.0)))) * (-1.0 / c));
} else {
tmp = (c / b) * -0.5;
}
return tmp;
}



Bits error versus a



Bits error versus b



Bits error versus c
Results
if b < -2.0971834524611091e149Initial program 62.2
Simplified62.2
Taylor expanded around -inf 2.3
if -2.0971834524611091e149 < b < -4.7048261067022572e-221Initial program 7.2
Simplified7.2
rmApplied associate-/r*_binary647.2
if -4.7048261067022572e-221 < b < 2.21722328276091895e108Initial program 30.8
Simplified30.8
rmApplied flip--_binary6430.9
Simplified16.4
Simplified16.4
rmApplied clear-num_binary6416.5
Simplified9.8
if 2.21722328276091895e108 < b Initial program 59.7
Simplified59.7
Taylor expanded around inf 2.2
Final simplification6.5
herbie shell --seed 2020232
(FPCore (a b c)
:name "Cubic critical"
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))