\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\begin{array}{l}
\mathbf{if}\;b \le -1.173641368412307 \cdot 10^{114}:\\
\;\;\;\;1 \cdot \left(\frac{c}{b} - \frac{b}{a}\right)\\
\mathbf{elif}\;b \le -3.7607628574451261 \cdot 10^{-174}:\\
\;\;\;\;\left(\left(-b\right) + \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}\right) \cdot \frac{1}{2 \cdot a}\\
\mathbf{elif}\;b \le 1.44430318372460742:\\
\;\;\;\;\frac{1}{\frac{0.5}{c} \cdot \left(\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}\right)}\\
\mathbf{else}:\\
\;\;\;\;-1 \cdot \frac{c}{b}\\
\end{array}double code(double a, double b, double c) {
return ((-b + sqrt(((b * b) - ((4.0 * a) * c)))) / (2.0 * a));
}
double code(double a, double b, double c) {
double VAR;
if ((b <= -1.173641368412307e+114)) {
VAR = (1.0 * ((c / b) - (b / a)));
} else {
double VAR_1;
if ((b <= -3.760762857445126e-174)) {
VAR_1 = ((-b + sqrt(((b * b) - (4.0 * (a * c))))) * (1.0 / (2.0 * a)));
} else {
double VAR_2;
if ((b <= 1.4443031837246074)) {
VAR_2 = (1.0 / ((0.5 / c) * (-b - sqrt(((b * b) - (4.0 * (a * c)))))));
} else {
VAR_2 = (-1.0 * (c / b));
}
VAR_1 = VAR_2;
}
VAR = VAR_1;
}
return VAR;
}



Bits error versus a



Bits error versus b



Bits error versus c
Results
if b < -1.173641368412307e+114Initial program 50.2
rmApplied associate-*l*50.2
Taylor expanded around -inf 3.6
Simplified3.6
if -1.173641368412307e+114 < b < -3.760762857445126e-174Initial program 6.4
rmApplied associate-*l*6.4
rmApplied div-inv6.5
if -3.760762857445126e-174 < b < 1.4443031837246074Initial program 23.1
rmApplied associate-*l*23.1
rmApplied flip-+23.4
Simplified16.8
rmApplied clear-num16.9
Simplified16.9
Taylor expanded around 0 11.7
if 1.4443031837246074 < b Initial program 56.0
rmApplied associate-*l*56.0
Taylor expanded around inf 5.7
Final simplification7.4
herbie shell --seed 2020103 +o rules:numerics
(FPCore (a b c)
:name "Quadratic roots, full range"
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 4 a) c)))) (* 2 a)))