\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.7028086930165435 \cdot 10^{+99}:\\
\;\;\;\;0.5 \cdot \frac{c}{b} - 0.6666666666666666 \cdot \frac{b}{a}\\
\mathbf{elif}\;b \leq 2.4133286600301676 \cdot 10^{-279}:\\
\;\;\;\;\frac{1}{\frac{3}{\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - b}{a}}}\\
\mathbf{elif}\;b \leq 1.7451134981590885 \cdot 10^{+117}:\\
\;\;\;\;0.3333333333333333 \cdot \frac{c \cdot -3}{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.7028086930165435e+99)
(- (* 0.5 (/ c b)) (* 0.6666666666666666 (/ b a)))
(if (<= b 2.4133286600301676e-279)
(/ 1.0 (/ 3.0 (/ (- (sqrt (- (* b b) (* c (* a 3.0)))) b) a)))
(if (<= b 1.7451134981590885e+117)
(*
0.3333333333333333
(/ (* c -3.0) (+ b (sqrt (- (* b b) (* c (* a 3.0)))))))
(* (/ c b) -0.5)))))double code(double a, double b, double c) {
return (((double) (((double) -(b)) + ((double) sqrt(((double) (((double) (b * b)) - ((double) (((double) (3.0 * a)) * c)))))))) / ((double) (3.0 * a)));
}
double code(double a, double b, double c) {
double tmp;
if ((b <= -1.7028086930165435e+99)) {
tmp = ((double) (((double) (0.5 * (c / b))) - ((double) (0.6666666666666666 * (b / a)))));
} else {
double tmp_1;
if ((b <= 2.4133286600301676e-279)) {
tmp_1 = (1.0 / (3.0 / (((double) (((double) sqrt(((double) (((double) (b * b)) - ((double) (c * ((double) (a * 3.0)))))))) - b)) / a)));
} else {
double tmp_2;
if ((b <= 1.7451134981590885e+117)) {
tmp_2 = ((double) (0.3333333333333333 * (((double) (c * -3.0)) / ((double) (b + ((double) sqrt(((double) (((double) (b * b)) - ((double) (c * ((double) (a * 3.0)))))))))))));
} else {
tmp_2 = ((double) ((c / b) * -0.5));
}
tmp_1 = tmp_2;
}
tmp = tmp_1;
}
return tmp;
}



Bits error versus a



Bits error versus b



Bits error versus c
Results
if b < -1.70280869301654355e99Initial program 46.9
Simplified46.9
Taylor expanded around -inf 4.2
if -1.70280869301654355e99 < b < 2.4133286600301676e-279Initial program 9.8
Simplified9.8
rmApplied clear-num_binary649.9
Simplified9.9
if 2.4133286600301676e-279 < b < 1.7451134981590885e117Initial program 33.3
Simplified33.3
rmApplied flip--_binary6433.3
Simplified16.5
Simplified16.5
rmApplied *-un-lft-identity_binary6416.5
Applied times-frac_binary6416.5
Simplified16.5
Simplified9.1
if 1.7451134981590885e117 < b Initial program 60.3
Simplified60.3
Taylor expanded around inf 2.1
Final simplification7.1
herbie shell --seed 2020219
(FPCore (a b c)
:name "Cubic critical"
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))