\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 -6.595237172330028 \cdot 10^{+80}:\\
\;\;\;\;0.5 \cdot \frac{c}{b} - 0.6666666666666666 \cdot \frac{b}{a}\\
\mathbf{elif}\;b \leq -6.630631873525022 \cdot 10^{-297}:\\
\;\;\;\;\frac{1}{\frac{3}{\frac{\sqrt{b \cdot b - 3 \cdot \left(c \cdot a\right)} - b}{a}}}\\
\mathbf{elif}\;b \leq 3.1370236091553266 \cdot 10^{+85}:\\
\;\;\;\;\frac{c}{\frac{b + \sqrt{b \cdot b - 3 \cdot \left(c \cdot a\right)}}{\frac{-a}{a}}}\\
\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 -6.595237172330028e+80)
(- (* 0.5 (/ c b)) (* 0.6666666666666666 (/ b a)))
(if (<= b -6.630631873525022e-297)
(/ 1.0 (/ 3.0 (/ (- (sqrt (- (* b b) (* 3.0 (* c a)))) b) a)))
(if (<= b 3.1370236091553266e+85)
(/ c (/ (+ b (sqrt (- (* b b) (* 3.0 (* c a))))) (/ (- a) a)))
(* (/ 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 <= -6.595237172330028e+80) {
tmp = (0.5 * (c / b)) - (0.6666666666666666 * (b / a));
} else if (b <= -6.630631873525022e-297) {
tmp = 1.0 / (3.0 / ((sqrt((b * b) - (3.0 * (c * a))) - b) / a));
} else if (b <= 3.1370236091553266e+85) {
tmp = c / ((b + sqrt((b * b) - (3.0 * (c * a)))) / (-a / a));
} else {
tmp = (c / b) * -0.5;
}
return tmp;
}



Bits error versus a



Bits error versus b



Bits error versus c
Results
if b < -6.59523717233002765e80Initial program 43.5
Simplified43.5
Taylor expanded around -inf 4.4
if -6.59523717233002765e80 < b < -6.63063187352502212e-297Initial program 8.1
Simplified8.1
rmApplied clear-num_binary64_14418.2
Simplified8.2
if -6.63063187352502212e-297 < b < 3.13702360915532657e85Initial program 31.1
Simplified31.1
rmApplied div-inv_binary64_143931.1
Simplified31.2
rmApplied flip--_binary64_141731.2
Simplified16.0
rmApplied pow1_binary64_150316.0
Applied pow1_binary64_150316.0
Applied pow-prod-down_binary64_151316.0
Simplified8.8
if 3.13702360915532657e85 < b Initial program 58.6
Simplified58.6
Taylor expanded around inf 3.2
Final simplification6.5
herbie shell --seed 2021032
(FPCore (a b c)
:name "Cubic critical"
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))