\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 -4.439880162502227 \cdot 10^{+90}:\\
\;\;\;\;\frac{\frac{b \cdot -2}{3}}{a}\\
\mathbf{elif}\;b \leq 1.3752342204584442 \cdot 10^{-108}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} - b}{3 \cdot a}\\
\mathbf{elif}\;b \leq 7.728774522489216 \cdot 10^{+106}:\\
\;\;\;\;a \cdot \frac{-\frac{c}{b + \sqrt{b \cdot b - 3 \cdot \left(a \cdot c\right)}}}{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 -4.439880162502227e+90)
(/ (/ (* b -2.0) 3.0) a)
(if (<= b 1.3752342204584442e-108)
(/ (- (sqrt (- (* b b) (* (* 3.0 a) c))) b) (* 3.0 a))
(if (<= b 7.728774522489216e+106)
(* a (/ (- (/ c (+ b (sqrt (- (* b b) (* 3.0 (* a c))))))) 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 <= -4.439880162502227e+90) {
tmp = ((b * -2.0) / 3.0) / a;
} else if (b <= 1.3752342204584442e-108) {
tmp = (sqrt((b * b) - ((3.0 * a) * c)) - b) / (3.0 * a);
} else if (b <= 7.728774522489216e+106) {
tmp = a * (-(c / (b + sqrt((b * b) - (3.0 * (a * c))))) / a);
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}



Bits error versus a



Bits error versus b



Bits error versus c
Results
if b < -4.4398801625022268e90Initial program 45.7
Simplified45.7
rmApplied associate-/r*_binary64_206845.7
Simplified45.6
Taylor expanded around -inf 5.1
if -4.4398801625022268e90 < b < 1.37523422045844416e-108Initial program 12.7
Simplified12.7
if 1.37523422045844416e-108 < b < 7.72877452248921616e106Initial program 41.7
Simplified41.7
rmApplied associate-/r*_binary64_206841.8
Simplified41.8
rmApplied flip--_binary64_209941.8
Simplified14.7
Simplified14.7
rmApplied *-un-lft-identity_binary64_212414.7
Applied *-un-lft-identity_binary64_212414.7
Applied *-un-lft-identity_binary64_212414.7
Applied times-frac_binary64_213013.3
Applied times-frac_binary64_213013.2
Applied times-frac_binary64_213019.8
Simplified19.8
Simplified19.6
if 7.72877452248921616e106 < b Initial program 59.7
Simplified59.7
Taylor expanded around inf 2.5
Final simplification10.3
herbie shell --seed 2021046
(FPCore (a b c)
:name "Cubic critical"
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))