\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 -6.390547163029555 \cdot 10^{+153}:\\
\;\;\;\;\frac{b \cdot -2}{3 \cdot a}\\
\mathbf{elif}\;b \leq 1.401312127821107 \cdot 10^{-198}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} - b}{3 \cdot a}\\
\mathbf{elif}\;b \leq 4.6234338566915484 \cdot 10^{+132}:\\
\;\;\;\;\frac{\frac{a \cdot \left(c \cdot -3\right)}{b + \sqrt{b \cdot b - 3 \cdot \left(a \cdot c\right)}}}{3 \cdot a}\\
\mathbf{else}:\\
\;\;\;\;\frac{-1.5 \cdot \frac{a \cdot c}{b}}{3 \cdot a}\\
\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 -6.390547163029555e+153)
(/ (* b -2.0) (* 3.0 a))
(if (<= b 1.401312127821107e-198)
(/ (- (sqrt (- (* b b) (* (* 3.0 a) c))) b) (* 3.0 a))
(if (<= b 4.6234338566915484e+132)
(/
(/ (* a (* c -3.0)) (+ b (sqrt (- (* b b) (* 3.0 (* a c))))))
(* 3.0 a))
(/ (* -1.5 (/ (* a c) b)) (* 3.0 a))))))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 <= -6.390547163029555e+153) {
tmp = (b * -2.0) / (3.0 * a);
} else if (b <= 1.401312127821107e-198) {
tmp = (sqrt((b * b) - ((3.0 * a) * c)) - b) / (3.0 * a);
} else if (b <= 4.6234338566915484e+132) {
tmp = ((a * (c * -3.0)) / (b + sqrt((b * b) - (3.0 * (a * c))))) / (3.0 * a);
} else {
tmp = (-1.5 * ((a * c) / b)) / (3.0 * a);
}
return tmp;
}



Bits error versus a



Bits error versus b



Bits error versus c
Results
if b < -6.3905471630295552e153Initial program 63.9
Simplified63.9
Taylor expanded around -inf 3.0
if -6.3905471630295552e153 < b < 1.40131212782110699e-198Initial program 10.3
if 1.40131212782110699e-198 < b < 4.6234338566915484e132Initial program 37.7
Simplified37.7
rmApplied flip--_binary64_244037.7
Simplified15.0
Simplified15.0
if 4.6234338566915484e132 < b Initial program 61.9
Simplified61.9
Taylor expanded around inf 14.6
Final simplification11.7
herbie shell --seed 2021058
(FPCore (a b c)
:name "Cubic critical"
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))