\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 -2.1711788034215313 \cdot 10^{+152}:\\
\;\;\;\;\frac{\left(-b\right) - b}{3 \cdot a}\\
\mathbf{elif}\;b \leq 12377142785381904000:\\
\;\;\;\;\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 -2.1711788034215313e+152)
(/ (- (- b) b) (* 3.0 a))
(if (<= b 12377142785381904000.0)
(/ (- (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 <= -2.1711788034215313e+152) {
tmp = (-b - b) / (3.0 * a);
} else if (b <= 12377142785381904000.0) {
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 < -2.1711788034215313e152Initial program 63.2
Taylor expanded in b around -inf 2.9
Simplified2.9
if -2.1711788034215313e152 < b < 12377142785381904000Initial program 17.1
Applied neg-sub0_binary6417.1
Applied associate-+l-_binary6417.1
if 12377142785381904000 < b Initial program 56.0
Taylor expanded in b around inf 16.1
Final simplification15.2
herbie shell --seed 2021280
(FPCore (a b c)
:name "Cubic critical"
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))