\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.881450868076512 \cdot 10^{+99}:\\
\;\;\;\;0.5 \cdot \frac{c}{b} - 0.6666666666666666 \cdot \frac{b}{a}\\
\mathbf{elif}\;b \leq -2.6232763968795353 \cdot 10^{-303}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - b}{a \cdot 3}\\
\mathbf{elif}\;b \leq 2.9927405752514035 \cdot 10^{+106}:\\
\;\;\;\;\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 -6.881450868076512e+99)
(- (* 0.5 (/ c b)) (* 0.6666666666666666 (/ b a)))
(if (<= b -2.6232763968795353e-303)
(/ (- (sqrt (- (* b b) (* c (* a 3.0)))) b) (* a 3.0))
(if (<= b 2.9927405752514035e+106)
(/ 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 <= -6.881450868076512e+99) {
tmp = (0.5 * (c / b)) - (0.6666666666666666 * (b / a));
} else if (b <= -2.6232763968795353e-303) {
tmp = (sqrt((b * b) - (c * (a * 3.0))) - b) / (a * 3.0);
} else if (b <= 2.9927405752514035e+106) {
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 < -6.88145086807651196e99Initial program 47.6
Simplified47.6
Taylor expanded around -inf 4.6
if -6.88145086807651196e99 < b < -2.62327639687953528e-303Initial program 9.0
Simplified9.0
if -2.62327639687953528e-303 < b < 2.9927405752514035e106Initial program 34.0
Simplified34.0
rmApplied flip--_binary6434.0
Simplified17.2
Simplified17.2
rmApplied clear-num_binary6417.3
Simplified9.9
if 2.9927405752514035e106 < b Initial program 60.3
Simplified60.3
Taylor expanded around inf 2.1
Final simplification7.0
herbie shell --seed 2020220
(FPCore (a b c)
:name "Cubic critical"
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))