\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.843460629957331 \cdot 10^{+100}:\\
\;\;\;\;\frac{1.5 \cdot \frac{a \cdot c}{b} - b \cdot 2}{a \cdot 3}\\
\mathbf{elif}\;b \leq 1.672182564513283 \cdot 10^{-279}:\\
\;\;\;\;\left(\frac{c}{3} \cdot \frac{1}{c}\right) \cdot \frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - b}{a}\\
\mathbf{elif}\;b \leq 6.036361899813576 \cdot 10^{+122}:\\
\;\;\;\;\frac{1}{\frac{\left(-b\right) - \sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)}}{c}}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{1.5 \cdot \frac{a \cdot c}{b} - b \cdot 2}{c}}\\
\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.843460629957331e+100)
(/ (- (* 1.5 (/ (* a c) b)) (* b 2.0)) (* a 3.0))
(if (<= b 1.672182564513283e-279)
(* (* (/ c 3.0) (/ 1.0 c)) (/ (- (sqrt (- (* b b) (* c (* a 3.0)))) b) a))
(if (<= b 6.036361899813576e+122)
(/ 1.0 (/ (- (- b) (sqrt (- (* b b) (* c (* a 3.0))))) c))
(/ 1.0 (/ (- (* 1.5 (/ (* a c) b)) (* b 2.0)) c))))))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.843460629957331e+100) {
tmp = ((1.5 * ((a * c) / b)) - (b * 2.0)) / (a * 3.0);
} else if (b <= 1.672182564513283e-279) {
tmp = ((c / 3.0) * (1.0 / c)) * ((sqrt((b * b) - (c * (a * 3.0))) - b) / a);
} else if (b <= 6.036361899813576e+122) {
tmp = 1.0 / ((-b - sqrt((b * b) - (c * (a * 3.0)))) / c);
} else {
tmp = 1.0 / (((1.5 * ((a * c) / b)) - (b * 2.0)) / c);
}
return tmp;
}



Bits error versus a



Bits error versus b



Bits error versus c
Results
if b < -5.8434606299573309e100Initial program 47.6
Taylor expanded around -inf 10.5
Simplified10.5
if -5.8434606299573309e100 < b < 1.672182564513283e-279Initial program 9.4
rmApplied flip-+_binary64_211733.0
Simplified33.0
rmApplied flip--_binary64_211833.2
Applied associate-/r/_binary64_208933.2
Applied times-frac_binary64_214933.2
Simplified9.6
Simplified9.6
if 1.672182564513283e-279 < b < 6.03636189981357567e122Initial program 33.9
rmApplied flip-+_binary64_211733.9
Simplified15.6
rmApplied clear-num_binary64_214215.8
Simplified8.1
if 6.03636189981357567e122 < b Initial program 60.9
rmApplied flip-+_binary64_211760.9
Simplified34.9
rmApplied clear-num_binary64_214235.0
Simplified33.7
Taylor expanded around inf 7.4
Simplified7.4
Final simplification8.8
herbie shell --seed 2020281
(FPCore (a b c)
:name "Cubic critical"
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))