\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.8784026798326835 \cdot 10^{+149}:\\
\;\;\;\;0.5 \cdot \frac{c}{b} - 0.6666666666666666 \cdot \frac{b}{a}\\
\mathbf{elif}\;b \leq 3.768751181218888 \cdot 10^{-301}:\\
\;\;\;\;\frac{\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - b}{3}}{a}\\
\mathbf{elif}\;b \leq 8.627093492358085 \cdot 10^{-16}:\\
\;\;\;\;\frac{a \cdot \frac{c \cdot -3}{b + \sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)}}}{a \cdot 3}\\
\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 -1.8784026798326835e+149)
(- (* 0.5 (/ c b)) (* 0.6666666666666666 (/ b a)))
(if (<= b 3.768751181218888e-301)
(/ (/ (- (sqrt (- (* b b) (* c (* a 3.0)))) b) 3.0) a)
(if (<= b 8.627093492358085e-16)
(/
(* a (/ (* c -3.0) (+ b (sqrt (- (* b b) (* c (* a 3.0)))))))
(* a 3.0))
(* (/ 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 <= -1.8784026798326835e+149) {
tmp = (0.5 * (c / b)) - (0.6666666666666666 * (b / a));
} else if (b <= 3.768751181218888e-301) {
tmp = ((sqrt((b * b) - (c * (a * 3.0))) - b) / 3.0) / a;
} else if (b <= 8.627093492358085e-16) {
tmp = (a * ((c * -3.0) / (b + sqrt((b * b) - (c * (a * 3.0)))))) / (a * 3.0);
} else {
tmp = (c / b) * -0.5;
}
return tmp;
}



Bits error versus a



Bits error versus b



Bits error versus c
Results
if b < -1.8784026798326835e149Initial program 62.2
Simplified62.2
Taylor expanded around -inf 2.8
if -1.8784026798326835e149 < b < 3.7687511812188879e-301Initial program 8.5
Simplified8.5
rmApplied associate-/r*_binary64_17088.5
if 3.7687511812188879e-301 < b < 8.62709349235808539e-16Initial program 26.7
Simplified26.7
rmApplied flip--_binary64_173726.7
Simplified19.4
Simplified19.4
rmApplied *-un-lft-identity_binary64_176219.4
Applied times-frac_binary64_176816.0
Simplified16.0
Simplified16.0
if 8.62709349235808539e-16 < b Initial program 54.9
Simplified54.9
Taylor expanded around inf 6.8
Final simplification8.7
herbie shell --seed 2020299
(FPCore (a b c)
:name "Cubic critical"
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))