\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.4299048034323493 \cdot 10^{+89}:\\
\;\;\;\;\frac{\frac{b \cdot -2}{3}}{a}\\
\mathbf{elif}\;b \leq 9.11384425434159 \cdot 10^{-72}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} - b}{3 \cdot a}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\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.4299048034323493e+89)
(/ (/ (* b -2.0) 3.0) a)
(if (<= b 9.11384425434159e-72)
(/ (- (sqrt (- (* b b) (* (* 3.0 a) c))) b) (* 3.0 a))
(* -0.5 (/ c b)))))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.4299048034323493e+89) {
tmp = ((b * -2.0) / 3.0) / a;
} else if (b <= 9.11384425434159e-72) {
tmp = (sqrt((b * b) - ((3.0 * a) * c)) - b) / (3.0 * a);
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}



Bits error versus a



Bits error versus b



Bits error versus c
Results
if b < -2.42990480343234933e89Initial program 44.4
Simplified44.5
Applied egg44.4
Applied egg34.8
Taylor expanded in b around -inf 3.9
if -2.42990480343234933e89 < b < 9.1138442543415896e-72Initial program 13.4
Applied egg13.4
if 9.1138442543415896e-72 < b Initial program 53.6
Simplified53.6
Taylor expanded in a around 0 8.7
Final simplification10.0
herbie shell --seed 2022125
(FPCore (a b c)
:name "Cubic critical"
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))