\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.3543978985140437 \cdot 10^{+138}:\\
\;\;\;\;\frac{\left(1.5 \cdot \frac{a \cdot c}{b} - b\right) - b}{a \cdot 3}\\
\mathbf{elif}\;b \leq -1.0583505148364568 \cdot 10^{-306}:\\
\;\;\;\;\frac{\sqrt{\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - b} \cdot \sqrt{\sqrt[3]{\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)}} \cdot \left(\sqrt[3]{\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)}} \cdot \sqrt[3]{\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)}}\right) - b}}{a \cdot 3}\\
\mathbf{elif}\;b \leq 4.6929395429942243 \cdot 10^{+154}:\\
\;\;\;\;0.3333333333333333 \cdot \frac{c \cdot -3}{b + \sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{a \cdot \left(c \cdot -3\right)}{b + \left(b - 1.5 \cdot \frac{a \cdot c}{b}\right)}}{a \cdot 3}\\
\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.3543978985140437e+138)
(/ (- (- (* 1.5 (/ (* a c) b)) b) b) (* a 3.0))
(if (<= b -1.0583505148364568e-306)
(/
(*
(sqrt (- (sqrt (- (* b b) (* c (* a 3.0)))) b))
(sqrt
(-
(*
(cbrt (sqrt (- (* b b) (* c (* a 3.0)))))
(*
(cbrt (sqrt (- (* b b) (* c (* a 3.0)))))
(cbrt (sqrt (- (* b b) (* c (* a 3.0)))))))
b)))
(* a 3.0))
(if (<= b 4.6929395429942243e+154)
(*
0.3333333333333333
(/ (* c -3.0) (+ b (sqrt (- (* b b) (* c (* a 3.0)))))))
(/ (/ (* a (* c -3.0)) (+ b (- b (* 1.5 (/ (* a c) b))))) (* a 3.0))))))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.3543978985140437e+138) {
tmp = (((1.5 * ((a * c) / b)) - b) - b) / (a * 3.0);
} else if (b <= -1.0583505148364568e-306) {
tmp = (sqrt(sqrt((b * b) - (c * (a * 3.0))) - b) * sqrt((cbrt(sqrt((b * b) - (c * (a * 3.0)))) * (cbrt(sqrt((b * b) - (c * (a * 3.0)))) * cbrt(sqrt((b * b) - (c * (a * 3.0)))))) - b)) / (a * 3.0);
} else if (b <= 4.6929395429942243e+154) {
tmp = 0.3333333333333333 * ((c * -3.0) / (b + sqrt((b * b) - (c * (a * 3.0)))));
} else {
tmp = ((a * (c * -3.0)) / (b + (b - (1.5 * ((a * c) / b))))) / (a * 3.0);
}
return tmp;
}



Bits error versus a



Bits error versus b



Bits error versus c
Results
if b < -1.35439789851404366e138Initial program 57.3
Simplified57.3
Taylor expanded around -inf 10.3
if -1.35439789851404366e138 < b < -1.0583505148364568e-306Initial program 8.8
Simplified8.8
rmApplied add-sqr-sqrt_binary649.0
rmApplied add-cube-cbrt_binary649.2
if -1.0583505148364568e-306 < b < 4.6929395429942243e154Initial program 34.1
Simplified34.1
rmApplied flip--_binary6434.1
Simplified15.0
Simplified15.0
rmApplied *-un-lft-identity_binary6415.0
Applied times-frac_binary6415.0
Simplified15.0
Simplified7.7
if 4.6929395429942243e154 < b Initial program 64.0
Simplified64.0
rmApplied flip--_binary6464.0
Simplified37.1
Simplified37.1
Taylor expanded around inf 13.8
Final simplification9.6
herbie shell --seed 2020260
(FPCore (a b c)
:name "Cubic critical"
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))