\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 -2.7863758169125638 \cdot 10^{138}:\\
\;\;\;\;\frac{1}{2} \cdot \left(2 \cdot \frac{c}{b} - 2 \cdot \frac{b}{a}\right)\\
\mathbf{elif}\;b \le 2.20848854156636544 \cdot 10^{-130}:\\
\;\;\;\;\frac{1}{\frac{2 \cdot a}{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}}\\
\mathbf{elif}\;b \le 1.9844148556213612 \cdot 10^{72}:\\
\;\;\;\;\frac{\frac{0 + 4 \cdot \left(a \cdot c\right)}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}}{2 \cdot a}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{2} \cdot \left(-2 \cdot \frac{c}{b}\right)\\
\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 <= -2.7863758169125638e+138)) {
VAR = ((1.0 / 2.0) * ((2.0 * (c / b)) - (2.0 * (b / a))));
} else {
double VAR_1;
if ((b <= 2.2084885415663654e-130)) {
VAR_1 = (1.0 / ((2.0 * a) / (-b + sqrt(((b * b) - ((4.0 * a) * c))))));
} else {
double VAR_2;
if ((b <= 1.9844148556213612e+72)) {
VAR_2 = (((0.0 + (4.0 * (a * c))) / (-b - sqrt(((b * b) - ((4.0 * a) * c))))) / (2.0 * a));
} else {
VAR_2 = ((1.0 / 2.0) * (-2.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 < -2.7863758169125638e+138Initial program 58.6
rmApplied clear-num58.6
rmApplied *-un-lft-identity58.6
Applied times-frac58.6
Applied add-cube-cbrt58.6
Applied times-frac58.6
Simplified58.6
Simplified58.6
Taylor expanded around -inf 2.6
if -2.7863758169125638e+138 < b < 2.2084885415663654e-130Initial program 10.9
rmApplied clear-num11.0
if 2.2084885415663654e-130 < b < 1.9844148556213612e+72Initial program 39.5
rmApplied flip-+39.5
Simplified16.9
if 1.9844148556213612e+72 < b Initial program 58.4
rmApplied clear-num58.4
rmApplied *-un-lft-identity58.4
Applied times-frac58.4
Applied add-cube-cbrt58.4
Applied times-frac58.4
Simplified58.4
Simplified58.4
Taylor expanded around inf 3.2
Final simplification8.9
herbie shell --seed 2020078 +o rules:numerics
(FPCore (a b c)
:name "Quadratic roots, full range"
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 4 a) c)))) (* 2 a)))