\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.68191977281259 \cdot 10^{+58}:\\
\;\;\;\;\frac{\frac{\left|b \cdot -2\right|}{3}}{a}\\
\mathbf{elif}\;b \leq 7.630379190543333 \cdot 10^{-98}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} - b}{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 -1.68191977281259e+58)
(/ (/ (fabs (* b -2.0)) 3.0) a)
(if (<= b 7.630379190543333e-98)
(/ (- (sqrt (- (* b b) (* (* 3.0 a) c))) b) (* 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 <= -1.68191977281259e+58) {
tmp = (fabs(b * -2.0) / 3.0) / a;
} else if (b <= 7.630379190543333e-98) {
tmp = (sqrt((b * b) - ((3.0 * a) * c)) - b) / (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 < -1.68191977281259011e58Initial program 40.1
Applied add-sqr-sqrt_binary6440.2
Simplified51.4
Simplified36.5
Applied add-sqr-sqrt_binary6436.5
Applied rem-sqrt-square_binary6436.5
Applied add-sqr-sqrt_binary6436.5
Applied rem-sqrt-square_binary6436.5
Applied mul-fabs_binary6436.5
Simplified36.3
Applied associate-/r*_binary6436.3
Taylor expanded in b around -inf 5.5
Simplified5.5
if -1.68191977281259011e58 < b < 7.6303791905433328e-98Initial program 12.4
Applied *-un-lft-identity_binary6412.4
if 7.6303791905433328e-98 < b Initial program 51.8
Taylor expanded in b around inf 20.8
Final simplification14.6
herbie shell --seed 2021224
(FPCore (a b c)
:name "Cubic critical"
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))