\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 -1.5159330162823798 \cdot 10^{-268}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)} - b}{a \cdot 2}\\
\mathbf{elif}\;b \leq 3.1009093014776278 \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 -1.5159330162823798e-268)
(/ (- (sqrt (- (* b b) (* c (* a 4.0)))) b) (* a 2.0))
(if (<= b 3.1009093014776278e+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 <= -1.5159330162823798e-268) {
tmp = (sqrt((b * b) - (c * (a * 4.0))) - b) / (a * 2.0);
} else if (b <= 3.1009093014776278e+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 < -1.51593301628237981e-268Initial program 8.1
Simplified8.1
if -1.51593301628237981e-268 < b < 3.10090930147762775e131Initial program 32.6
Simplified32.6
rmApplied flip--_binary64_39832.7
Simplified16.2
Simplified16.2
rmApplied *-un-lft-identity_binary64_42316.2
Applied times-frac_binary64_42914.2
Applied times-frac_binary64_4298.9
Simplified8.9
Simplified8.9
if 3.10090930147762775e131 < b Initial program 61.4
Simplified61.4
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)))