\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 -6.97667166683124 \cdot 10^{+151}:\\
\;\;\;\;\frac{c}{b} - \frac{b}{a}\\
\mathbf{elif}\;b \leq -3.3856076934378627 \cdot 10^{-242}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)} - b}{a \cdot 2}\\
\mathbf{elif}\;b \leq 8.912861377839782 \cdot 10^{+134}:\\
\;\;\;\;-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 -6.97667166683124e+151)
(- (/ c b) (/ b a))
(if (<= b -3.3856076934378627e-242)
(/ (- (sqrt (- (* b b) (* c (* a 4.0)))) b) (* a 2.0))
(if (<= b 8.912861377839782e+134)
(* -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 <= -6.97667166683124e+151) {
tmp = (c / b) - (b / a);
} else if (b <= -3.3856076934378627e-242) {
tmp = (sqrt((b * b) - (c * (a * 4.0))) - b) / (a * 2.0);
} else if (b <= 8.912861377839782e+134) {
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 < -6.97667166683124e151Initial program 62.7
Simplified62.7
Taylor expanded around -inf 1.9
if -6.97667166683124e151 < b < -3.3856076934378627e-242Initial program 8.3
Simplified8.3
if -3.3856076934378627e-242 < b < 8.91286137783978178e134Initial program 31.7
Simplified31.7
rmApplied flip--_binary64_278131.7
Simplified15.8
Simplified15.8
rmApplied *-un-lft-identity_binary64_280615.8
Applied times-frac_binary64_281213.9
Applied times-frac_binary64_28129.1
Simplified9.1
Simplified9.1
if 8.91286137783978178e134 < b Initial program 61.7
Simplified61.7
Taylor expanded around inf 1.6
Simplified1.6
Final simplification6.5
herbie shell --seed 2020355
(FPCore (a b c)
:name "Quadratic roots, full range"
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a)))