\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.0269296551259906 \cdot 10^{+155}:\\
\;\;\;\;\frac{-b}{a}\\
\mathbf{elif}\;b \leq 2.4057886654314162 \cdot 10^{-178}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - \left(a \cdot 4\right) \cdot c} - b}{a \cdot 2}\\
\mathbf{elif}\;b \leq 6.283616353584907 \cdot 10^{+110}:\\
\;\;\;\;\frac{\left(c \cdot \left(a \cdot -4\right)\right) \cdot \frac{0.5}{a}}{b + \sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\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.0269296551259906e+155)
(/ (- b) a)
(if (<= b 2.4057886654314162e-178)
(/ (- (sqrt (- (* b b) (* (* a 4.0) c))) b) (* a 2.0))
(if (<= b 6.283616353584907e+110)
(/
(* (* c (* a -4.0)) (/ 0.5 a))
(+ b (sqrt (fma a (* c -4.0) (* b b)))))
(- (/ 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.0269296551259906e+155) {
tmp = -b / a;
} else if (b <= 2.4057886654314162e-178) {
tmp = (sqrt((b * b) - ((a * 4.0) * c)) - b) / (a * 2.0);
} else if (b <= 6.283616353584907e+110) {
tmp = ((c * (a * -4.0)) * (0.5 / a)) / (b + sqrt(fma(a, (c * -4.0), (b * b))));
} else {
tmp = -(c / b);
}
return tmp;
}



Bits error versus a



Bits error versus b



Bits error versus c
if b < -1.02692965512599057e155Initial program 36.3
Simplified36.2
Taylor expanded in b around -inf 1.3
Simplified1.3
if -1.02692965512599057e155 < b < 2.4057886654314162e-178Initial program 9.5
if 2.4057886654314162e-178 < b < 6.28361635358490653e110Initial program 38.5
Simplified38.5
Applied flip--_binary6438.7
Applied associate-*l/_binary6438.7
Simplified14.7
if 6.28361635358490653e110 < b Initial program 59.8
Simplified59.8
Taylor expanded in a around 0 2.3
Simplified2.3
Final simplification7.9
herbie shell --seed 2022067
(FPCore (a b c)
:name "Quadratic roots, full range"
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a)))