\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 -1.3971509965545484 \cdot 10^{+115}:\\
\;\;\;\;\mathsf{fma}\left(0.5, \frac{c}{b}, \frac{b}{a} \cdot -0.6666666666666666\right)\\
\mathbf{else}:\\
\;\;\;\;\begin{array}{l}
t_0 := \sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - b\\
\mathbf{if}\;b \leq 1.2626367882715619 \cdot 10^{-142}:\\
\;\;\;\;\frac{t_0}{a \cdot 3}\\
\mathbf{elif}\;b \leq 1.579289878984042 \cdot 10^{-78} \lor \neg \left(b \leq 3.0301703971888995 \cdot 10^{-45}\right):\\
\;\;\;\;\frac{c}{b} \cdot -0.5\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{a \cdot 3}{t_0}}\\
\end{array}\\
\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 -1.3971509965545484e+115)
(fma 0.5 (/ c b) (* (/ b a) -0.6666666666666666))
(let* ((t_0 (- (sqrt (- (* b b) (* c (* a 3.0)))) b)))
(if (<= b 1.2626367882715619e-142)
(/ t_0 (* a 3.0))
(if (or (<= b 1.579289878984042e-78)
(not (<= b 3.0301703971888995e-45)))
(* (/ c b) -0.5)
(/ 1.0 (/ (* a 3.0) t_0)))))))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 <= -1.3971509965545484e+115) {
tmp = fma(0.5, (c / b), ((b / a) * -0.6666666666666666));
} else {
double t_0 = sqrt((b * b) - (c * (a * 3.0))) - b;
double tmp_1;
if (b <= 1.2626367882715619e-142) {
tmp_1 = t_0 / (a * 3.0);
} else if ((b <= 1.579289878984042e-78) || !(b <= 3.0301703971888995e-45)) {
tmp_1 = (c / b) * -0.5;
} else {
tmp_1 = 1.0 / ((a * 3.0) / t_0);
}
tmp = tmp_1;
}
return tmp;
}



Bits error versus a



Bits error versus b



Bits error versus c
if b < -1.3971509965545484e115Initial program 51.0
Taylor expanded in b around -inf 3.7
Simplified3.7
if -1.3971509965545484e115 < b < 1.26263678827156191e-142Initial program 11.5
if 1.26263678827156191e-142 < b < 1.5792898789840419e-78 or 3.0301703971888995e-45 < b Initial program 51.4
Taylor expanded in b around inf 11.6
if 1.5792898789840419e-78 < b < 3.0301703971888995e-45Initial program 34.9
Applied clear-num_binary6434.9
Final simplification11.0
herbie shell --seed 2022004
(FPCore (a b c)
:name "Cubic critical"
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))