\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 -3.657670422663459 \cdot 10^{+37}:\\
\;\;\;\;\frac{\frac{b \cdot -2}{3}}{a}\\
\mathbf{elif}\;b \leq 2.053250763506355 \cdot 10^{-126}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} - \frac{b}{3 \cdot a}\\
\mathbf{elif}\;b \leq 5.632271499779473 \cdot 10^{+36}:\\
\;\;\;\;\frac{\frac{\frac{a}{\sqrt[3]{b + \sqrt{b \cdot b - 3 \cdot \left(a \cdot c\right)}} \cdot \sqrt[3]{b + \sqrt{b \cdot b - 3 \cdot \left(a \cdot c\right)}}}}{\sqrt[3]{3} \cdot \sqrt[3]{3}}}{\sqrt[3]{a} \cdot \sqrt[3]{a}} \cdot \frac{\frac{\frac{c \cdot -3}{\sqrt[3]{b + \sqrt{b \cdot b - 3 \cdot \left(a \cdot c\right)}}}}{\sqrt[3]{3}}}{\sqrt[3]{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 -3.657670422663459e+37)
(/ (/ (* b -2.0) 3.0) a)
(if (<= b 2.053250763506355e-126)
(- (/ (sqrt (- (* b b) (* (* 3.0 a) c))) (* 3.0 a)) (/ b (* 3.0 a)))
(if (<= b 5.632271499779473e+36)
(*
(/
(/
(/
a
(*
(cbrt (+ b (sqrt (- (* b b) (* 3.0 (* a c))))))
(cbrt (+ b (sqrt (- (* b b) (* 3.0 (* a c))))))))
(* (cbrt 3.0) (cbrt 3.0)))
(* (cbrt a) (cbrt a)))
(/
(/
(/ (* c -3.0) (cbrt (+ b (sqrt (- (* b b) (* 3.0 (* a c)))))))
(cbrt 3.0))
(cbrt 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 <= -3.657670422663459e+37) {
tmp = ((b * -2.0) / 3.0) / a;
} else if (b <= 2.053250763506355e-126) {
tmp = (sqrt((b * b) - ((3.0 * a) * c)) / (3.0 * a)) - (b / (3.0 * a));
} else if (b <= 5.632271499779473e+36) {
tmp = (((a / (cbrt(b + sqrt((b * b) - (3.0 * (a * c)))) * cbrt(b + sqrt((b * b) - (3.0 * (a * c)))))) / (cbrt(3.0) * cbrt(3.0))) / (cbrt(a) * cbrt(a))) * ((((c * -3.0) / cbrt(b + sqrt((b * b) - (3.0 * (a * c))))) / cbrt(3.0)) / cbrt(a));
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}



Bits error versus a



Bits error versus b



Bits error versus c
Results
if b < -3.6576704226634589e37Initial program 35.9
Simplified35.9
rmApplied associate-/r*_binary64_445535.9
Simplified35.9
Taylor expanded around -inf 6.0
if -3.6576704226634589e37 < b < 2.0532507635063549e-126Initial program 12.9
Simplified12.9
rmApplied div-sub_binary64_451612.9
if 2.0532507635063549e-126 < b < 5.63227149977947251e36Initial program 38.9
Simplified38.9
rmApplied associate-/r*_binary64_445539.0
Simplified39.0
rmApplied flip--_binary64_448639.0
Simplified18.1
Simplified18.1
rmApplied add-cube-cbrt_binary64_454618.7
Applied add-cube-cbrt_binary64_454618.7
Applied add-cube-cbrt_binary64_454618.9
Applied times-frac_binary64_451715.9
Applied times-frac_binary64_451715.9
Applied times-frac_binary64_451711.2
if 5.63227149977947251e36 < b Initial program 56.6
Simplified56.6
Taylor expanded around inf 4.6
Final simplification8.8
herbie shell --seed 2021077
(FPCore (a b c)
:name "Cubic critical"
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))