\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.4109566075029235 \cdot 10^{+110}:\\
\;\;\;\;0.5 \cdot \frac{c}{b} - 0.6666666666666666 \cdot \frac{b}{a}\\
\mathbf{elif}\;b \leq 2.5062143377504272 \cdot 10^{-285}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)}}{a \cdot 3} - \frac{b}{a \cdot 3}\\
\mathbf{elif}\;b \leq 9.027388520595384 \cdot 10^{+104}:\\
\;\;\;\;\frac{-c}{b + \sqrt{b \cdot b - c \cdot \left(a \cdot 3\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 -1.4109566075029235e+110)
(- (* 0.5 (/ c b)) (* 0.6666666666666666 (/ b a)))
(if (<= b 2.5062143377504272e-285)
(- (/ (sqrt (- (* b b) (* c (* a 3.0)))) (* a 3.0)) (/ b (* a 3.0)))
(if (<= b 9.027388520595384e+104)
(/ (- c) (+ b (sqrt (- (* b b) (* c (* a 3.0))))))
(* (/ 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 <= -1.4109566075029235e+110) {
tmp = (0.5 * (c / b)) - (0.6666666666666666 * (b / a));
} else if (b <= 2.5062143377504272e-285) {
tmp = (sqrt((b * b) - (c * (a * 3.0))) / (a * 3.0)) - (b / (a * 3.0));
} else if (b <= 9.027388520595384e+104) {
tmp = -c / (b + sqrt((b * b) - (c * (a * 3.0))));
} else {
tmp = (c / b) * -0.5;
}
return tmp;
}



Bits error versus a



Bits error versus b



Bits error versus c
Results
if b < -1.4109566075029235e110Initial program 50.0
Simplified50.0
Taylor expanded around -inf 3.6
if -1.4109566075029235e110 < b < 2.5062143377504272e-285Initial program 8.6
Simplified8.6
rmApplied div-sub_binary648.6
if 2.5062143377504272e-285 < b < 9.0273885205953844e104Initial program 33.1
Simplified33.1
rmApplied flip--_binary6433.2
Simplified16.4
Simplified16.4
rmApplied *-un-lft-identity_binary6416.4
Applied times-frac_binary6416.5
Simplified16.5
Simplified8.2
rmApplied associate-*r/_binary648.2
Applied associate-*r/_binary648.1
Simplified7.9
if 9.0273885205953844e104 < b Initial program 60.1
Simplified60.1
Taylor expanded around inf 1.9
Final simplification6.1
herbie shell --seed 2020224
(FPCore (a b c)
:name "Cubic critical"
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))