\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}
\begin{array}{l}
\mathbf{if}\;b \leq -3.7715774085615172 \cdot 10^{+37}:\\
\;\;\;\;\frac{\left(-b\right) - b}{2 \cdot a}\\
\mathbf{else}:\\
\;\;\;\;\begin{array}{l}
t_0 := \sqrt{b \cdot b - \left(a \cdot 4\right) \cdot c}\\
\mathbf{if}\;b \leq -1.9357207753357807 \cdot 10^{-308}:\\
\;\;\;\;\frac{t_0}{2 \cdot a} - \frac{b}{2 \cdot a}\\
\mathbf{elif}\;b \leq 2.3431308109665615 \cdot 10^{+85}:\\
\;\;\;\;\frac{2 \cdot c}{\left(-b\right) - t_0}\\
\mathbf{else}:\\
\;\;\;\;-\frac{c}{b}\\
\end{array}\\
\end{array}
(FPCore (a b c) :precision binary64 (/ (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a)))
(FPCore (a b c)
:precision binary64
(if (<= b -3.7715774085615172e+37)
(/ (- (- b) b) (* 2.0 a))
(let* ((t_0 (sqrt (- (* b b) (* (* a 4.0) c)))))
(if (<= b -1.9357207753357807e-308)
(- (/ t_0 (* 2.0 a)) (/ b (* 2.0 a)))
(if (<= b 2.3431308109665615e+85)
(/ (* 2.0 c) (- (- b) t_0))
(- (/ c b)))))))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 tmp;
if (b <= -3.7715774085615172e+37) {
tmp = (-b - b) / (2.0 * a);
} else {
double t_0 = sqrt((b * b) - ((a * 4.0) * c));
double tmp_1;
if (b <= -1.9357207753357807e-308) {
tmp_1 = (t_0 / (2.0 * a)) - (b / (2.0 * a));
} else if (b <= 2.3431308109665615e+85) {
tmp_1 = (2.0 * c) / (-b - t_0);
} else {
tmp_1 = -(c / b);
}
tmp = tmp_1;
}
return tmp;
}



Bits error versus a



Bits error versus b



Bits error versus c
Results
if b < -3.7715774085615172e37Initial program 35.7
Taylor expanded in b around -inf 5.9
if -3.7715774085615172e37 < b < -1.9357207753357807e-308Initial program 9.3
Applied +-commutative_binary649.3
Applied neg-sub0_binary649.3
Applied associate-+r-_binary649.3
Applied div-sub_binary649.3
if -1.9357207753357807e-308 < b < 2.34313081096656152e85Initial program 31.4
Applied clear-num_binary6431.4
Applied flip-+_binary6431.4
Applied associate-/r/_binary6431.5
Applied associate-/r*_binary6431.5
Simplified15.8
Taylor expanded in c around 0 8.8
if 2.34313081096656152e85 < b Initial program 58.0
Taylor expanded in b around inf 3.1
Simplified3.1
Final simplification6.8
herbie shell --seed 2022068
(FPCore (a b c)
:name "Quadratic roots, full range"
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a)))