\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 -8.182845608862169 \cdot 10^{+150}:\\
\;\;\;\;\frac{\left(b \cdot -2\right) \cdot 0.3333333333333333}{a}\\
\mathbf{elif}\;b \leq 1.1498395275009536 \cdot 10^{-168}:\\
\;\;\;\;\frac{\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -3\right)\right)} - b}{a \cdot 3}\\
\mathbf{elif}\;b \leq 5.17555123963869 \cdot 10^{+45}:\\
\;\;\;\;\frac{\frac{0.3333333333333333 \cdot \mathsf{fma}\left(a, c \cdot -3, 0\right)}{b + \sqrt{\mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)}}}{a}\\
\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 -8.182845608862169e+150)
(/ (* (* b -2.0) 0.3333333333333333) a)
(if (<= b 1.1498395275009536e-168)
(/ (- (sqrt (fma b b (* c (* a -3.0)))) b) (* a 3.0))
(if (<= b 5.17555123963869e+45)
(/
(/
(* 0.3333333333333333 (fma a (* c -3.0) 0.0))
(+ b (sqrt (fma a (* c -3.0) (* b b)))))
a)
(* -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 <= -8.182845608862169e+150) {
tmp = ((b * -2.0) * 0.3333333333333333) / a;
} else if (b <= 1.1498395275009536e-168) {
tmp = (sqrt(fma(b, b, (c * (a * -3.0)))) - b) / (a * 3.0);
} else if (b <= 5.17555123963869e+45) {
tmp = ((0.3333333333333333 * fma(a, (c * -3.0), 0.0)) / (b + sqrt(fma(a, (c * -3.0), (b * b))))) / a;
} else {
tmp = -0.5 * (c / b);
}
return tmp;
}



Bits error versus a



Bits error versus b



Bits error versus c
if b < -8.1828456088621686e150Initial program 36.6
Simplified36.5
Applied associate-*r/_binary6436.5
Taylor expanded in b around -inf 1.5
if -8.1828456088621686e150 < b < 1.14983952750095361e-168Initial program 9.1
Applied fma-neg_binary649.1
Simplified9.1
if 1.14983952750095361e-168 < b < 5.1755512396386903e45Initial program 35.1
Simplified35.2
Applied associate-*r/_binary6435.2
Applied flip--_binary6435.5
Applied associate-*l/_binary6435.5
Simplified17.1
if 5.1755512396386903e45 < b Initial program 55.8
Simplified55.8
Taylor expanded in a around 0 4.4
Final simplification7.8
herbie shell --seed 2022068
(FPCore (a b c)
:name "Cubic critical"
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))