\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.9352038855422006 \cdot 10^{+98}:\\
\;\;\;\;\frac{\left(-b\right) - b}{3 \cdot a}\\
\mathbf{elif}\;b \leq 2.543157513544152 \cdot 10^{-126}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} - b}{3 \cdot a}\\
\mathbf{elif}\;b \leq 1645583.6515607869:\\
\;\;\;\;\frac{\left(a \cdot \left(c \cdot -3\right)\right) \cdot \frac{0.3333333333333333}{a}}{b + \sqrt{\mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)}}\\
\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 -3.9352038855422006e+98)
(/ (- (- b) b) (* 3.0 a))
(if (<= b 2.543157513544152e-126)
(/ (- (sqrt (- (* b b) (* (* 3.0 a) c))) b) (* 3.0 a))
(if (<= b 1645583.6515607869)
(/
(* (* a (* c -3.0)) (/ 0.3333333333333333 a))
(+ b (sqrt (fma a (* c -3.0) (* b b)))))
(* -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 <= -3.9352038855422006e+98) {
tmp = (-b - b) / (3.0 * a);
} else if (b <= 2.543157513544152e-126) {
tmp = (sqrt((b * b) - ((3.0 * a) * c)) - b) / (3.0 * a);
} else if (b <= 1645583.6515607869) {
tmp = ((a * (c * -3.0)) * (0.3333333333333333 / a)) / (b + sqrt(fma(a, (c * -3.0), (b * b))));
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}



Bits error versus a



Bits error versus b



Bits error versus c
if b < -3.9352038855422006e98Initial program 46.6
Taylor expanded in b around -inf 3.6
Simplified3.6
if -3.9352038855422006e98 < b < 2.543157513544152e-126Initial program 11.9
Applied *-un-lft-identity_binary6411.9
if 2.543157513544152e-126 < b < 1645583.65156078688Initial program 37.2
Simplified37.2
Applied flip--_binary6437.2
Applied associate-*l/_binary6437.2
Simplified16.5
if 1645583.65156078688 < b Initial program 56.1
Simplified56.1
Taylor expanded in a around 0 5.5
Final simplification9.0
herbie shell --seed 2022125
(FPCore (a b c)
:name "Cubic critical"
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))