\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.350987509722503 \cdot 10^{+107}:\\
\;\;\;\;\frac{1}{\sqrt[3]{3} \cdot \sqrt[3]{3}} \cdot \left(\frac{\frac{b}{a}}{\sqrt[3]{3}} \cdot -2\right)\\
\mathbf{elif}\;b \leq 4.2393047293392074 \cdot 10^{-139}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} - b}{3 \cdot a}\\
\mathbf{elif}\;b \leq 1.1308364602898941 \cdot 10^{+67}:\\
\;\;\;\;\frac{\frac{a \cdot \left(c \cdot -3\right)}{b + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}}{3 \cdot a}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\
\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.350987509722503e+107)
(* (/ 1.0 (* (cbrt 3.0) (cbrt 3.0))) (* (/ (/ b a) (cbrt 3.0)) -2.0))
(if (<= b 4.2393047293392074e-139)
(/ (- (sqrt (- (* b b) (* (* 3.0 a) c))) b) (* 3.0 a))
(if (<= b 1.1308364602898941e+67)
(/
(/ (* a (* c -3.0)) (+ b (sqrt (- (* b b) (* (* 3.0 a) c)))))
(* 3.0 a))
(* -0.5 (/ c b))))))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.350987509722503e+107) {
tmp = (1.0 / (cbrt(3.0) * cbrt(3.0))) * (((b / a) / cbrt(3.0)) * -2.0);
} else if (b <= 4.2393047293392074e-139) {
tmp = (sqrt((b * b) - ((3.0 * a) * c)) - b) / (3.0 * a);
} else if (b <= 1.1308364602898941e+67) {
tmp = ((a * (c * -3.0)) / (b + sqrt((b * b) - ((3.0 * a) * c)))) / (3.0 * a);
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}



Bits error versus a



Bits error versus b



Bits error versus c
Results
if b < -6.3509875097225029e107Initial program 50.5
Simplified50.5
rmApplied clear-num_binary6450.6
Simplified50.6
rmApplied *-un-lft-identity_binary6450.6
Applied *-un-lft-identity_binary6450.6
Applied times-frac_binary6450.6
Applied add-cube-cbrt_binary6450.6
Applied times-frac_binary6450.6
Applied add-sqr-sqrt_binary6450.6
Applied times-frac_binary6450.6
Simplified50.6
Simplified50.6
Taylor expanded around -inf 4.4
Simplified4.3
if -6.3509875097225029e107 < b < 4.2393047293392074e-139Initial program 11.4
Simplified11.4
if 4.2393047293392074e-139 < b < 1.13083646028989413e67Initial program 37.8
Simplified37.8
rmApplied flip--_binary6437.8
Simplified16.3
Simplified16.3
if 1.13083646028989413e67 < b Initial program 57.8
Simplified57.8
Taylor expanded around inf 3.4
Final simplification9.0
herbie shell --seed 2020275
(FPCore (a b c)
:name "Cubic critical"
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))