\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}
\begin{array}{l}
t_0 := \mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)\\
t_1 := \sqrt{t_0}\\
t_2 := -\frac{c}{b}\\
\mathbf{if}\;b \leq -1.251564096671974 \cdot 10^{+46}:\\
\;\;\;\;\frac{c}{b} - \frac{b}{a}\\
\mathbf{elif}\;b \leq 1.2846674157042731 \cdot 10^{-107}:\\
\;\;\;\;\frac{t_1}{a \cdot 2} - \frac{b}{a \cdot 2}\\
\mathbf{elif}\;b \leq 1.3948090615163448 \cdot 10^{-71}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;b \leq 4.4233955990605117 \cdot 10^{-54}:\\
\;\;\;\;\frac{\left(t_0 - b \cdot b\right) \cdot \frac{0.5}{a}}{b + t_1}\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\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
(let* ((t_0 (fma a (* c -4.0) (* b b))) (t_1 (sqrt t_0)) (t_2 (- (/ c b))))
(if (<= b -1.251564096671974e+46)
(- (/ c b) (/ b a))
(if (<= b 1.2846674157042731e-107)
(- (/ t_1 (* a 2.0)) (/ b (* a 2.0)))
(if (<= b 1.3948090615163448e-71)
t_2
(if (<= b 4.4233955990605117e-54)
(/ (* (- t_0 (* b b)) (/ 0.5 a)) (+ b t_1))
t_2))))))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 t_0 = fma(a, (c * -4.0), (b * b));
double t_1 = sqrt(t_0);
double t_2 = -(c / b);
double tmp;
if (b <= -1.251564096671974e+46) {
tmp = (c / b) - (b / a);
} else if (b <= 1.2846674157042731e-107) {
tmp = (t_1 / (a * 2.0)) - (b / (a * 2.0));
} else if (b <= 1.3948090615163448e-71) {
tmp = t_2;
} else if (b <= 4.4233955990605117e-54) {
tmp = ((t_0 - (b * b)) * (0.5 / a)) / (b + t_1);
} else {
tmp = t_2;
}
return tmp;
}



Bits error versus a



Bits error versus b



Bits error versus c
if b < -1.25156409667197408e46Initial program 38.4
Simplified38.4
Taylor expanded in b around -inf 5.2
if -1.25156409667197408e46 < b < 1.28466741570427313e-107Initial program 13.0
Simplified13.1
Applied egg-rr13.0
Applied egg-rr13.0
if 1.28466741570427313e-107 < b < 1.3948090615163448e-71 or 4.4233955990605117e-54 < b Initial program 52.7
Simplified52.7
Taylor expanded in a around 0 9.5
if 1.3948090615163448e-71 < b < 4.4233955990605117e-54Initial program 33.7
Simplified33.8
Applied egg-rr33.8
Final simplification10.3
herbie shell --seed 2022130
(FPCore (a b c)
:name "Quadratic roots, full range"
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a)))