\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.7674460872703884 \cdot 10^{+149}:\\
\;\;\;\;0.5 \cdot \frac{c}{b} - 0.6666666666666666 \cdot \frac{b}{a}\\
\mathbf{elif}\;b \leq -1.2677949885504426 \cdot 10^{-305}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - b}{a \cdot 3}\\
\mathbf{elif}\;b \leq 3.432315266375116 \cdot 10^{+113}:\\
\;\;\;\;\frac{\frac{a}{a} \cdot \left(-c\right)}{b + \sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)}}\\
\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.7674460872703884e+149)
(- (* 0.5 (/ c b)) (* 0.6666666666666666 (/ b a)))
(if (<= b -1.2677949885504426e-305)
(/ (- (sqrt (- (* b b) (* c (* a 3.0)))) b) (* a 3.0))
(if (<= b 3.432315266375116e+113)
(/ (* (/ a a) (- c)) (+ b (sqrt (- (* b b) (* c (* 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.7674460872703884e+149) {
tmp = (0.5 * (c / b)) - (0.6666666666666666 * (b / a));
} else if (b <= -1.2677949885504426e-305) {
tmp = (sqrt((b * b) - (c * (a * 3.0))) - b) / (a * 3.0);
} else if (b <= 3.432315266375116e+113) {
tmp = ((a / a) * -c) / (b + sqrt((b * b) - (c * (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.76744608727038835e149Initial program 62.3
Simplified62.3
Taylor expanded around -inf 2.2
if -1.76744608727038835e149 < b < -1.2677949885504426e-305Initial program 9.4
if -1.2677949885504426e-305 < b < 3.4323152663751158e113Initial program 32.1
Simplified32.1
rmApplied div-inv_binary64_212132.1
Simplified32.2
rmApplied flip--_binary64_209932.2
Simplified15.7
Simplified15.7
rmApplied associate-*l/_binary64_206714.5
Simplified7.7
if 3.4323152663751158e113 < b Initial program 60.3
Simplified60.3
Taylor expanded around inf 2.1
Final simplification6.4
herbie shell --seed 2020354
(FPCore (a b c)
:name "Cubic critical"
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))