\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.3014879836557515 \cdot 10^{+97}:\\
\;\;\;\;\frac{c}{b} - \frac{b}{a}\\
\mathbf{elif}\;b \leq -1.8145284637786566 \cdot 10^{-293}:\\
\;\;\;\;\frac{1}{\frac{a}{\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)} - b}{2}}}\\
\mathbf{elif}\;b \leq 6.972667102848289 \cdot 10^{+99}:\\
\;\;\;\;\frac{c \cdot -2}{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.3014879836557515e+97)
(- (/ c b) (/ b a))
(if (<= b -1.8145284637786566e-293)
(/ 1.0 (/ a (/ (- (sqrt (- (* b b) (* c (* a 4.0)))) b) 2.0)))
(if (<= b 6.972667102848289e+99)
(/ (* c -2.0) (+ 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.3014879836557515e+97) {
tmp = (c / b) - (b / a);
} else if (b <= -1.8145284637786566e-293) {
tmp = 1.0 / (a / ((sqrt((b * b) - (c * (a * 4.0))) - b) / 2.0));
} else if (b <= 6.972667102848289e+99) {
tmp = (c * -2.0) / (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.3014879836557515e97Initial program 46.0
Simplified46.0
Taylor expanded around -inf 3.9
if -1.3014879836557515e97 < b < -1.81452846377865664e-293Initial program 9.6
Simplified9.6
rmApplied clear-num_binary64_4229.7
Simplified9.7
if -1.81452846377865664e-293 < b < 6.97266710284828931e99Initial program 31.6
Simplified31.6
rmApplied flip--_binary64_39831.7
Simplified16.2
Simplified16.2
rmApplied div-inv_binary64_42016.2
Applied times-frac_binary64_42915.2
Simplified9.0
Simplified9.0
rmApplied associate-*r/_binary64_3658.8
Simplified8.8
if 6.97266710284828931e99 < b Initial program 59.4
Simplified59.4
Taylor expanded around inf 2.7
Simplified2.7
Final simplification6.8
herbie shell --seed 2020292
(FPCore (a b c)
:name "Quadratic roots, full range"
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a)))