\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.6719904792053715 \cdot 10^{+126}:\\
\;\;\;\;0.5 \cdot \frac{c}{b} + \frac{b}{a} \cdot -0.6666666666666666\\
\mathbf{elif}\;b \leq -1.0659637489022944 \cdot 10^{-294}:\\
\;\;\;\;\frac{\frac{\sqrt{b \cdot b - 3 \cdot \left(c \cdot a\right)} - b}{3}}{a}\\
\mathbf{elif}\;b \leq 2.710249643306574 \cdot 10^{+91}:\\
\;\;\;\;\frac{-c}{b + \sqrt{b \cdot b - 3 \cdot \left(c \cdot a\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 -3.6719904792053715e+126)
(+ (* 0.5 (/ c b)) (* (/ b a) -0.6666666666666666))
(if (<= b -1.0659637489022944e-294)
(/ (/ (- (sqrt (- (* b b) (* 3.0 (* c a)))) b) 3.0) a)
(if (<= b 2.710249643306574e+91)
(/ (- c) (+ b (sqrt (- (* b b) (* 3.0 (* c 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 <= -3.6719904792053715e+126) {
tmp = (0.5 * (c / b)) + ((b / a) * -0.6666666666666666);
} else if (b <= -1.0659637489022944e-294) {
tmp = ((sqrt((b * b) - (3.0 * (c * a))) - b) / 3.0) / a;
} else if (b <= 2.710249643306574e+91) {
tmp = -c / (b + sqrt((b * b) - (3.0 * (c * a))));
} else {
tmp = (c / b) * -0.5;
}
return tmp;
}



Bits error versus a



Bits error versus b



Bits error versus c
Results
if b < -3.6719904792053715e126Initial program 54.9
Simplified54.9
Taylor expanded around -inf 3.8
Simplified3.8
if -3.6719904792053715e126 < b < -1.06596374890229441e-294Initial program 8.7
Simplified8.7
rmApplied associate-/r*_binary64_27508.7
Simplified8.6
if -1.06596374890229441e-294 < b < 2.710249643306574e91Initial program 31.5
Simplified31.5
rmApplied associate-/r*_binary64_275031.5
Simplified31.5
rmApplied flip--_binary64_278131.5
Simplified17.0
Simplified17.0
rmApplied *-un-lft-identity_binary64_280617.0
Applied div-inv_binary64_280317.1
Applied times-frac_binary64_281217.0
Simplified14.3
Simplified14.3
rmApplied associate-*r/_binary64_274817.0
Applied associate-*l/_binary64_274916.3
Simplified8.6
if 2.710249643306574e91 < b Initial program 59.0
Simplified59.0
Taylor expanded around inf 2.6
Final simplification6.5
herbie shell --seed 2021028
(FPCore (a b c)
:name "Cubic critical"
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))