\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 -6.738042698067906 \cdot 10^{+47}:\\
\;\;\;\;0.5 \cdot \frac{c}{b} - 0.6666666666666666 \cdot \frac{b}{a}\\
\mathbf{elif}\;b \leq -1.3703763978612727 \cdot 10^{-221}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - b}{a \cdot 3}\\
\mathbf{elif}\;b \leq 4.677485094739758 \cdot 10^{+106}:\\
\;\;\;\;\frac{-c}{b + \sqrt{b \cdot b - c \cdot \left(a \cdot 3\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 -6.738042698067906e+47)
(- (* 0.5 (/ c b)) (* 0.6666666666666666 (/ b a)))
(if (<= b -1.3703763978612727e-221)
(/ (- (sqrt (- (* b b) (* c (* a 3.0)))) b) (* a 3.0))
(if (<= b 4.677485094739758e+106)
(/ (- c) (+ b (sqrt (- (* b b) (* c (* 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 <= -6.738042698067906e+47) {
tmp = (0.5 * (c / b)) - (0.6666666666666666 * (b / a));
} else if (b <= -1.3703763978612727e-221) {
tmp = (sqrt((b * b) - (c * (a * 3.0))) - b) / (a * 3.0);
} else if (b <= 4.677485094739758e+106) {
tmp = -c / (b + sqrt((b * b) - (c * (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 < -6.73804269806790567e47Initial program 39.2
Simplified39.2
Taylor expanded around -inf 6.3
if -6.73804269806790567e47 < b < -1.37037639786127275e-221Initial program 8.1
if -1.37037639786127275e-221 < b < 4.6774850947397581e106Initial program 30.7
Simplified30.7
rmApplied flip--_binary64_141730.8
Simplified17.3
Simplified17.3
rmApplied *-un-lft-identity_binary64_144217.3
Applied times-frac_binary64_144817.3
Simplified17.3
Simplified10.6
rmApplied pow1_binary64_150310.6
Applied pow1_binary64_150310.6
Applied pow-prod-down_binary64_151310.6
Applied pow1_binary64_150310.6
Applied pow-prod-down_binary64_151310.6
Simplified10.3
if 4.6774850947397581e106 < b Initial program 60.1
Simplified60.1
Taylor expanded around inf 2.8
Final simplification7.3
herbie shell --seed 2020352
(FPCore (a b c)
:name "Cubic critical"
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))