\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 -1.2490394173203949 \cdot 10^{+78}:\\
\;\;\;\;0.5 \cdot \frac{c}{b} - 0.6666666666666666 \cdot \frac{b}{a}\\
\mathbf{elif}\;b \leq -3.2016173609121512 \cdot 10^{-291}:\\
\;\;\;\;\frac{\sqrt{b \cdot b + a \cdot \left(c \cdot -3\right)} - b}{a \cdot 3}\\
\mathbf{elif}\;b \leq 1.4494405112157072 \cdot 10^{+119}:\\
\;\;\;\;3 \cdot \frac{\frac{c}{b + \sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)}}}{-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 -1.2490394173203949e+78)
(- (* 0.5 (/ c b)) (* 0.6666666666666666 (/ b a)))
(if (<= b -3.2016173609121512e-291)
(/ (- (sqrt (+ (* b b) (* a (* c -3.0)))) b) (* a 3.0))
(if (<= b 1.4494405112157072e+119)
(* 3.0 (/ (/ c (+ b (sqrt (- (* b b) (* c (* a 3.0)))))) -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 <= -1.2490394173203949e+78) {
tmp = (0.5 * (c / b)) - (0.6666666666666666 * (b / a));
} else if (b <= -3.2016173609121512e-291) {
tmp = (sqrt((b * b) + (a * (c * -3.0))) - b) / (a * 3.0);
} else if (b <= 1.4494405112157072e+119) {
tmp = 3.0 * ((c / (b + sqrt((b * b) - (c * (a * 3.0))))) / -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 < -1.24903941732039485e78Initial program 42.2
Simplified42.2
Taylor expanded around -inf 4.5
if -1.24903941732039485e78 < b < -3.2016173609121512e-291Initial program 9.0
Simplified9.0
rmApplied sub-neg_binary64_10949.0
Simplified9.1
if -3.2016173609121512e-291 < b < 1.44944051121570723e119Initial program 31.6
Simplified31.6
rmApplied flip--_binary64_107631.7
Simplified15.6
Simplified15.6
rmApplied frac-2neg_binary64_111215.6
Simplified15.5
Simplified15.5
rmApplied *-un-lft-identity_binary64_110115.5
Applied times-frac_binary64_110713.4
Applied times-frac_binary64_11078.0
Simplified7.9
if 1.44944051121570723e119 < b Initial program 60.5
Simplified60.5
Taylor expanded around inf 2.1
Final simplification6.3
herbie shell --seed 2020308
(FPCore (a b c)
:name "Cubic critical"
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))