\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 -1.3249665758399062 \cdot 10^{+154}:\\
\;\;\;\;\frac{2 \cdot \left(\frac{a \cdot c}{b} - b\right)}{2 \cdot a}\\
\mathbf{elif}\;b \leq 2.227512516590462 \cdot 10^{-227}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)} - b}{2 \cdot a}\\
\mathbf{elif}\;b \leq 5.134094891995538 \cdot 10^{+120}:\\
\;\;\;\;-2 \cdot \frac{c}{b + \sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)}}\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \frac{c}{2 \cdot \left(b - \frac{a \cdot c}{b}\right)}\\
\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 -1.3249665758399062e+154)
(/ (* 2.0 (- (/ (* a c) b) b)) (* 2.0 a))
(if (<= b 2.227512516590462e-227)
(/ (- (sqrt (- (* b b) (* c (* a 4.0)))) b) (* 2.0 a))
(if (<= b 5.134094891995538e+120)
(* -2.0 (/ c (+ b (sqrt (- (* b b) (* c (* a 4.0)))))))
(* -2.0 (/ c (* 2.0 (- b (/ (* a 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 <= -1.3249665758399062e+154) {
tmp = (2.0 * (((a * c) / b) - b)) / (2.0 * a);
} else if (b <= 2.227512516590462e-227) {
tmp = (sqrt((b * b) - (c * (a * 4.0))) - b) / (2.0 * a);
} else if (b <= 5.134094891995538e+120) {
tmp = -2.0 * (c / (b + sqrt((b * b) - (c * (a * 4.0)))));
} else {
tmp = -2.0 * (c / (2.0 * (b - ((a * c) / b))));
}
return tmp;
}



Bits error versus a



Bits error versus b



Bits error versus c
Results
if b < -1.32496657583990621e154Initial program 64.0
Simplified64.0
Taylor expanded around -inf 12.1
Simplified12.1
if -1.32496657583990621e154 < b < 2.2275125165904618e-227Initial program 9.3
Simplified9.3
if 2.2275125165904618e-227 < b < 5.13409489199553824e120Initial program 36.7
Simplified36.7
rmApplied flip--_binary64_38936.8
Simplified17.2
Simplified17.2
rmApplied *-un-lft-identity_binary64_41417.2
Applied times-frac_binary64_42014.4
Applied times-frac_binary64_4207.1
Simplified7.1
Simplified7.1
if 5.13409489199553824e120 < b Initial program 61.2
Simplified61.2
rmApplied flip--_binary64_38961.2
Simplified34.2
Simplified34.2
rmApplied *-un-lft-identity_binary64_41434.2
Applied times-frac_binary64_42034.1
Applied times-frac_binary64_42032.5
Simplified32.5
Simplified32.5
Taylor expanded around inf 5.6
Simplified5.6
Final simplification8.2
herbie shell --seed 2020281
(FPCore (a b c)
:name "Quadratic roots, full range"
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a)))