\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 -7.1093208455340995 \cdot 10^{+90}:\\
\;\;\;\;\frac{c}{b} - \frac{b}{a}\\
\mathbf{elif}\;b \leq -2.038598643446564 \cdot 10^{-267}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)} - b}{a \cdot 2}\\
\mathbf{elif}\;b \leq 1.341209881992474 \cdot 10^{+131}:\\
\;\;\;\;-2 \cdot \frac{c}{b + \sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)}}\\
\mathbf{else}:\\
\;\;\;\;-\frac{c}{b}\\
\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 -7.1093208455340995e+90)
(- (/ c b) (/ b a))
(if (<= b -2.038598643446564e-267)
(/ (- (sqrt (- (* b b) (* c (* a 4.0)))) b) (* a 2.0))
(if (<= b 1.341209881992474e+131)
(* -2.0 (/ c (+ b (sqrt (- (* b b) (* c (* a 4.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 <= -7.1093208455340995e+90) {
tmp = (c / b) - (b / a);
} else if (b <= -2.038598643446564e-267) {
tmp = (sqrt((b * b) - (c * (a * 4.0))) - b) / (a * 2.0);
} else if (b <= 1.341209881992474e+131) {
tmp = -2.0 * (c / (b + sqrt((b * b) - (c * (a * 4.0)))));
} else {
tmp = -(c / b);
}
return tmp;
}



Bits error versus a



Bits error versus b



Bits error versus c
Results
if b < -7.10932084553409946e90Initial program 45.1
Simplified45.1
Taylor expanded around -inf 3.7
if -7.10932084553409946e90 < b < -2.03859864344656402e-267Initial program 8.0
Simplified8.0
if -2.03859864344656402e-267 < b < 1.34120988199247398e131Initial program 32.6
Simplified32.6
rmApplied flip--_binary64_39832.6
Simplified16.2
Simplified16.2
rmApplied *-un-lft-identity_binary64_42316.2
Applied times-frac_binary64_42914.2
Applied times-frac_binary64_4299.0
Simplified9.0
Simplified8.9
if 1.34120988199247398e131 < b Initial program 61.3
Simplified61.3
Taylor expanded around inf 1.9
Simplified1.9
Final simplification6.4
herbie shell --seed 2020289
(FPCore (a b c)
:name "Quadratic roots, full range"
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a)))