\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.2977258341580385 \cdot 10^{+154}:\\
\;\;\;\;\frac{c}{b} - \frac{b}{a}\\
\mathbf{elif}\;b \leq 1.5108660979098973 \cdot 10^{-293}:\\
\;\;\;\;\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.059898287600192 \cdot 10^{+114}:\\
\;\;\;\;-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 -1.2977258341580385e+154)
(- (/ c b) (/ b a))
(if (<= b 1.5108660979098973e-293)
(- (/ (sqrt (- (* b b) (* c (* a 4.0)))) (* a 2.0)) (/ b (* a 2.0)))
(if (<= b 5.059898287600192e+114)
(* -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 <= -1.2977258341580385e+154) {
tmp = (c / b) - (b / a);
} else if (b <= 1.5108660979098973e-293) {
tmp = (sqrt((b * b) - (c * (a * 4.0))) / (a * 2.0)) - (b / (a * 2.0));
} else if (b <= 5.059898287600192e+114) {
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 < -1.2977258341580385e154Initial program 63.9
Simplified63.9
Taylor expanded around -inf 2.0
if -1.2977258341580385e154 < b < 1.5108660979098973e-293Initial program 8.9
Simplified8.9
rmApplied div-sub_binary64_4248.9
if 1.5108660979098973e-293 < b < 5.05989828760019195e114Initial program 33.4
Simplified33.4
rmApplied flip--_binary64_39433.4
Simplified16.2
Simplified16.2
rmApplied *-un-lft-identity_binary64_41916.2
Applied times-frac_binary64_42513.8
Applied times-frac_binary64_4258.3
Simplified8.3
Simplified8.3
if 5.05989828760019195e114 < b Initial program 60.0
Simplified60.0
Taylor expanded around inf 2.2
Simplified2.2
Final simplification6.4
herbie shell --seed 2020308
(FPCore (a b c)
:name "Quadratic roots, full range"
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a)))