\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 -2.264426810687682 \cdot 10^{+97}:\\
\;\;\;\;0.5 \cdot \frac{c}{b} - 0.6666666666666666 \cdot \frac{b}{a}\\
\mathbf{elif}\;b \leq 4.5622646438935884 \cdot 10^{-86}:\\
\;\;\;\;\frac{\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - b}{3}}{a}\\
\mathbf{elif}\;b \leq 7.906987275663061 \cdot 10^{+21}:\\
\;\;\;\;\frac{\frac{a \cdot \left(c \cdot -3\right)}{b + \sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)}}}{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 -2.264426810687682e+97)
(- (* 0.5 (/ c b)) (* 0.6666666666666666 (/ b a)))
(if (<= b 4.5622646438935884e-86)
(/ (/ (- (sqrt (- (* b b) (* c (* a 3.0)))) b) 3.0) a)
(if (<= b 7.906987275663061e+21)
(/
(/ (* a (* c -3.0)) (+ b (sqrt (- (* b b) (* c (* a 3.0))))))
(* 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 <= -2.264426810687682e+97) {
tmp = (0.5 * (c / b)) - (0.6666666666666666 * (b / a));
} else if (b <= 4.5622646438935884e-86) {
tmp = ((sqrt((b * b) - (c * (a * 3.0))) - b) / 3.0) / a;
} else if (b <= 7.906987275663061e+21) {
tmp = ((a * (c * -3.0)) / (b + sqrt((b * b) - (c * (a * 3.0))))) / (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 < -2.2644268106876821e97Initial program 45.7
Simplified45.7
Taylor expanded around -inf 4.0
if -2.2644268106876821e97 < b < 4.56226464389358836e-86Initial program 12.9
Simplified12.9
rmApplied associate-/r*_binary64_170812.9
if 4.56226464389358836e-86 < b < 7906987275663061290000Initial program 38.5
Simplified38.5
rmApplied flip--_binary64_173738.6
Simplified15.1
Simplified15.1
if 7906987275663061290000 < b Initial program 56.4
Simplified56.4
Taylor expanded around inf 4.3
Final simplification9.0
herbie shell --seed 2020288
(FPCore (a b c)
:name "Cubic critical"
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))