\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 -7.010251554888555 \cdot 10^{+146}:\\
\;\;\;\;0.5 \cdot \frac{c}{b} - 0.6666666666666666 \cdot \frac{b}{a}\\
\mathbf{elif}\;b \leq 4.445528153888977 \cdot 10^{-98}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - b}{a \cdot 3}\\
\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 -7.010251554888555e+146)
(- (* 0.5 (/ c b)) (* 0.6666666666666666 (/ b a)))
(if (<= b 4.445528153888977e-98)
(/ (- (sqrt (- (* b b) (* c (* a 3.0)))) b) (* 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 <= -7.010251554888555e+146) {
tmp = (0.5 * (c / b)) - (0.6666666666666666 * (b / a));
} else if (b <= 4.445528153888977e-98) {
tmp = (sqrt((b * b) - (c * (a * 3.0))) - b) / (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 < -7.01025155488855493e146Initial program 61.0
Simplified61.0
Taylor expanded around -inf 2.9
if -7.01025155488855493e146 < b < 4.44552815388897706e-98Initial program 11.8
Simplified11.8
rmApplied *-un-lft-identity_binary6411.8
if 4.44552815388897706e-98 < b Initial program 52.2
Simplified52.2
Taylor expanded around inf 10.4
Final simplification10.2
herbie shell --seed 2021110
(FPCore (a b c)
:name "Cubic critical"
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))