\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 -2.5949872779844862 \cdot 10^{+153}:\\
\;\;\;\;\frac{c}{b} - \frac{b}{a}\\
\mathbf{elif}\;b \leq 3.843995825405104 \cdot 10^{-296}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)}}{a \cdot 2} - \frac{b}{a \cdot 2}\\
\mathbf{elif}\;b \leq 5.781577797177691 \cdot 10^{+70}:\\
\;\;\;\;-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 -2.5949872779844862e+153)
(- (/ c b) (/ b a))
(if (<= b 3.843995825405104e-296)
(- (/ (sqrt (- (* b b) (* c (* a 4.0)))) (* a 2.0)) (/ b (* a 2.0)))
(if (<= b 5.781577797177691e+70)
(* -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 <= -2.5949872779844862e+153) {
tmp = (c / b) - (b / a);
} else if (b <= 3.843995825405104e-296) {
tmp = (sqrt((b * b) - (c * (a * 4.0))) / (a * 2.0)) - (b / (a * 2.0));
} else if (b <= 5.781577797177691e+70) {
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 < -2.5949872779844862e153Initial program 63.8
Simplified63.8
Taylor expanded around -inf 2.0
if -2.5949872779844862e153 < b < 3.84399582540510414e-296Initial program 8.1
Simplified8.1
rmApplied div-sub_binary64_4198.1
if 3.84399582540510414e-296 < b < 5.7815777971776913e70Initial program 30.3
Simplified30.3
rmApplied flip--_binary64_38930.3
Simplified15.6
Simplified15.6
rmApplied *-un-lft-identity_binary64_41415.6
Applied times-frac_binary64_42013.3
Applied times-frac_binary64_4208.5
Simplified8.5
Simplified8.5
if 5.7815777971776913e70 < b Initial program 58.2
Simplified58.2
Taylor expanded around inf 3.4
Simplified3.4
Final simplification6.4
herbie shell --seed 2020299
(FPCore (a b c)
:name "Quadratic roots, full range"
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a)))