\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.561650439314054 \cdot 10^{+78}:\\
\;\;\;\;0.5 \cdot \frac{c}{b} - 0.6666666666666666 \cdot \frac{b}{a}\\
\mathbf{elif}\;b \leq 4.965784922272556 \cdot 10^{-271}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - b}{a \cdot 3}\\
\mathbf{elif}\;b \leq 1.4541237874109192 \cdot 10^{+101}:\\
\;\;\;\;\frac{\frac{a \cdot \frac{c \cdot -3}{b + \sqrt{b \cdot b - 3 \cdot \left(c \cdot a\right)}}}{3}}{a}\\
\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 -6.561650439314054e+78)
(- (* 0.5 (/ c b)) (* 0.6666666666666666 (/ b a)))
(if (<= b 4.965784922272556e-271)
(/ (- (sqrt (- (* b b) (* c (* a 3.0)))) b) (* a 3.0))
(if (<= b 1.4541237874109192e+101)
(/
(/ (* a (/ (* c -3.0) (+ b (sqrt (- (* b b) (* 3.0 (* c a))))))) 3.0)
a)
(* (/ c b) -0.5)))))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.561650439314054e+78) {
tmp = (0.5 * (c / b)) - (0.6666666666666666 * (b / a));
} else if (b <= 4.965784922272556e-271) {
tmp = (sqrt((b * b) - (c * (a * 3.0))) - b) / (a * 3.0);
} else if (b <= 1.4541237874109192e+101) {
tmp = ((a * ((c * -3.0) / (b + sqrt((b * b) - (3.0 * (c * a)))))) / 3.0) / a;
} else {
tmp = (c / b) * -0.5;
}
return tmp;
}



Bits error versus a



Bits error versus b



Bits error versus c
Results
if b < -6.56165043931405438e78Initial program 43.3
Simplified43.3
Taylor expanded around -inf 5.2
if -6.56165043931405438e78 < b < 4.9657849222725563e-271Initial program 10.3
if 4.9657849222725563e-271 < b < 1.4541237874109192e101Initial program 34.4
Simplified34.4
rmApplied associate-/r*_binary64_309134.5
Simplified34.4
rmApplied flip--_binary64_312234.5
Simplified17.2
Simplified17.2
rmApplied *-un-lft-identity_binary64_314717.2
Applied times-frac_binary64_315314.7
Simplified14.7
if 1.4541237874109192e101 < b Initial program 59.1
Simplified59.1
Taylor expanded around inf 2.8
Final simplification9.0
herbie shell --seed 2021098
(FPCore (a b c)
:name "Cubic critical"
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))