\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 -3.161255245507665 \cdot 10^{+105}:\\
\;\;\;\;\frac{c}{b} - \frac{b}{a}\\
\mathbf{elif}\;b \leq 7.151073671652035 \cdot 10^{-308}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)} - b}{a \cdot 2}\\
\mathbf{elif}\;b \leq 9.806096002062306 \cdot 10^{+108}:\\
\;\;\;\;-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 -3.161255245507665e+105)
(- (/ c b) (/ b a))
(if (<= b 7.151073671652035e-308)
(/ (- (sqrt (- (* b b) (* c (* a 4.0)))) b) (* a 2.0))
(if (<= b 9.806096002062306e+108)
(* -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 <= -3.161255245507665e+105) {
tmp = (c / b) - (b / a);
} else if (b <= 7.151073671652035e-308) {
tmp = (sqrt((b * b) - (c * (a * 4.0))) - b) / (a * 2.0);
} else if (b <= 9.806096002062306e+108) {
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 < -3.1612552455076648e105Initial program 48.8
Simplified48.8
Taylor expanded around -inf 3.5
if -3.1612552455076648e105 < b < 7.15107367165203506e-308Initial program 9.3
Simplified9.3
if 7.15107367165203506e-308 < b < 9.8060960020623061e108Initial program 32.0
Simplified32.0
rmApplied flip--_binary64_278132.0
Simplified16.0
Simplified16.0
rmApplied *-un-lft-identity_binary64_280616.0
Applied times-frac_binary64_281213.7
Applied times-frac_binary64_28128.5
Simplified8.5
Simplified8.5
if 9.8060960020623061e108 < b Initial program 60.0
Simplified60.0
Taylor expanded around inf 2.3
Simplified2.3
Final simplification6.6
herbie shell --seed 2020356
(FPCore (a b c)
:name "Quadratic roots, full range"
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a)))