\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 -5.43891712310251 \cdot 10^{+135}:\\
\;\;\;\;\frac{b \cdot -2}{3 \cdot a}\\
\mathbf{elif}\;b \leq -2.5850424185292603 \cdot 10^{-267}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} - \frac{b}{3 \cdot a}\\
\mathbf{elif}\;b \leq 1.3383888372372949 \cdot 10^{+51}:\\
\;\;\;\;\frac{1}{\frac{3}{\frac{c \cdot -3}{b + \sqrt{b \cdot b - 3 \cdot \left(a \cdot c\right)}}}}\\
\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 -5.43891712310251e+135)
(/ (* b -2.0) (* 3.0 a))
(if (<= b -2.5850424185292603e-267)
(- (/ (sqrt (- (* b b) (* (* 3.0 a) c))) (* 3.0 a)) (/ b (* 3.0 a)))
(if (<= b 1.3383888372372949e+51)
(/ 1.0 (/ 3.0 (/ (* c -3.0) (+ b (sqrt (- (* b b) (* 3.0 (* a c))))))))
(* -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 <= -5.43891712310251e+135) {
tmp = (b * -2.0) / (3.0 * a);
} else if (b <= -2.5850424185292603e-267) {
tmp = (sqrt((b * b) - ((3.0 * a) * c)) / (3.0 * a)) - (b / (3.0 * a));
} else if (b <= 1.3383888372372949e+51) {
tmp = 1.0 / (3.0 / ((c * -3.0) / (b + sqrt((b * b) - (3.0 * (a * c))))));
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}



Bits error versus a



Bits error versus b



Bits error versus c
Results
if b < -5.4389171231025101e135Initial program 58.0
Simplified58.0
Taylor expanded around -inf 2.7
Simplified2.7
if -5.4389171231025101e135 < b < -2.58504241852926e-267Initial program 8.1
Simplified8.1
rmApplied div-sub_binary64_24708.1
if -2.58504241852926e-267 < b < 1.33838883723729491e51Initial program 29.0
Simplified29.0
rmApplied clear-num_binary64_246429.1
Simplified29.1
rmApplied flip--_binary64_244029.1
Simplified16.9
Simplified16.9
rmApplied *-un-lft-identity_binary64_246516.9
Applied *-un-lft-identity_binary64_246516.9
Applied times-frac_binary64_247116.9
Simplified16.9
Simplified10.2
if 1.33838883723729491e51 < b Initial program 57.2
Simplified57.2
Taylor expanded around inf 4.2
Final simplification6.9
herbie shell --seed 2021026
(FPCore (a b c)
:name "Cubic critical"
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))