\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 -5.05350087668616 \cdot 10^{+142}:\\
\;\;\;\;\frac{c}{b} \cdot 0.5 - 0.6666666666666666 \cdot \frac{b}{a}\\
\mathbf{elif}\;b \leq -3.0932591459060287 \cdot 10^{-302}:\\
\;\;\;\;\frac{\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - b}{3}}{a}\\
\mathbf{elif}\;b \leq 2.3119185569929864 \cdot 10^{+122}:\\
\;\;\;\;-\frac{c}{b + \sqrt{b \cdot b - 3 \cdot \left(c \cdot a\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 -5.05350087668616e+142)
(- (* (/ c b) 0.5) (* 0.6666666666666666 (/ b a)))
(if (<= b -3.0932591459060287e-302)
(/ (/ (- (sqrt (- (* b b) (* c (* a 3.0)))) b) 3.0) a)
(if (<= b 2.3119185569929864e+122)
(- (/ c (+ b (sqrt (- (* b b) (* 3.0 (* c a)))))))
(* (/ c b) -0.5)))))double code(double a, double b, double c) {
return (((double) (((double) -(b)) + ((double) sqrt(((double) (((double) (b * b)) - ((double) (((double) (3.0 * a)) * c)))))))) / ((double) (3.0 * a)));
}
double code(double a, double b, double c) {
double tmp;
if ((b <= -5.05350087668616e+142)) {
tmp = ((double) (((double) ((c / b) * 0.5)) - ((double) (0.6666666666666666 * (b / a)))));
} else {
double tmp_1;
if ((b <= -3.0932591459060287e-302)) {
tmp_1 = ((((double) (((double) sqrt(((double) (((double) (b * b)) - ((double) (c * ((double) (a * 3.0)))))))) - b)) / 3.0) / a);
} else {
double tmp_2;
if ((b <= 2.3119185569929864e+122)) {
tmp_2 = ((double) -((c / ((double) (b + ((double) sqrt(((double) (((double) (b * b)) - ((double) (3.0 * ((double) (c * a)))))))))))));
} else {
tmp_2 = ((double) ((c / b) * -0.5));
}
tmp_1 = tmp_2;
}
tmp = tmp_1;
}
return tmp;
}



Bits error versus a



Bits error versus b



Bits error versus c
Results
if b < -5.05350087668616048e142Initial program Error: 59.6 bits
SimplifiedError: 59.6 bits
Taylor expanded around -inf Error: 3.2 bits
SimplifiedError: 3.2 bits
if -5.05350087668616048e142 < b < -3.09325914590602866e-302Initial program Error: 8.5 bits
SimplifiedError: 8.5 bits
rmApplied associate-/r*Error: 8.5 bits
if -3.09325914590602866e-302 < b < 2.3119185569929864e122Initial program Error: 33.8 bits
SimplifiedError: 33.8 bits
rmApplied flip--Error: 33.8 bits
SimplifiedError: 16.1 bits
SimplifiedError: 16.1 bits
rmApplied distribute-frac-negError: 16.1 bits
Applied distribute-frac-negError: 16.1 bits
SimplifiedError: 8.3 bits
rmApplied associate-*l*Error: 8.3 bits
if 2.3119185569929864e122 < b Initial program Error: 61.3 bits
SimplifiedError: 61.3 bits
Taylor expanded around inf Error: 2.2 bits
Final simplificationError: 6.3 bits
herbie shell --seed 2020205
(FPCore (a b c)
:name "Cubic critical"
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))