\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\
\end{array}
\begin{array}{l}
t_0 := \frac{c}{b} - \frac{b}{a}\\
\mathbf{if}\;b \leq -1.8019041569772403 \cdot 10^{+111}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{2 \cdot c}{\mathsf{fma}\left(-1, b, -\mathsf{hypot}\left(\sqrt{\left(c \cdot a\right) \cdot -4}, b\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}\\
\mathbf{elif}\;b \leq 6.108410036495975 \cdot 10^{+62}:\\
\;\;\;\;\begin{array}{l}
t_1 := \sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)}\\
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{2 \cdot c}{\left(-b\right) - t_1}\\
\mathbf{else}:\\
\;\;\;\;\frac{t_1 - b}{2 \cdot a}\\
\end{array}\\
\mathbf{elif}\;b \geq 0:\\
\;\;\;\;-\frac{c}{b}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
(FPCore (a b c) :precision binary64 (if (>= b 0.0) (/ (* 2.0 c) (- (- b) (sqrt (- (* b b) (* (* 4.0 a) c))))) (/ (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a))))
(FPCore (a b c)
:precision binary64
(let* ((t_0 (- (/ c b) (/ b a))))
(if (<= b -1.8019041569772403e+111)
(if (>= b 0.0)
(/ (* 2.0 c) (fma -1.0 b (- (hypot (sqrt (* (* c a) -4.0)) b))))
t_0)
(if (<= b 6.108410036495975e+62)
(let* ((t_1 (sqrt (- (* b b) (* c (* a 4.0))))))
(if (>= b 0.0) (/ (* 2.0 c) (- (- b) t_1)) (/ (- t_1 b) (* 2.0 a))))
(if (>= b 0.0) (- (/ c b)) t_0)))))double code(double a, double b, double c) {
double tmp;
if (b >= 0.0) {
tmp = (2.0 * c) / (-b - sqrt((b * b) - ((4.0 * a) * c)));
} else {
tmp = (-b + sqrt((b * b) - ((4.0 * a) * c))) / (2.0 * a);
}
return tmp;
}
double code(double a, double b, double c) {
double t_0 = (c / b) - (b / a);
double tmp_1;
if (b <= -1.8019041569772403e+111) {
double tmp_2;
if (b >= 0.0) {
tmp_2 = (2.0 * c) / fma(-1.0, b, -hypot(sqrt((c * a) * -4.0), b));
} else {
tmp_2 = t_0;
}
tmp_1 = tmp_2;
} else if (b <= 6.108410036495975e+62) {
double t_1 = sqrt((b * b) - (c * (a * 4.0)));
double tmp_3;
if (b >= 0.0) {
tmp_3 = (2.0 * c) / (-b - t_1);
} else {
tmp_3 = (t_1 - b) / (2.0 * a);
}
tmp_1 = tmp_3;
} else if (b >= 0.0) {
tmp_1 = -(c / b);
} else {
tmp_1 = t_0;
}
return tmp_1;
}



Bits error versus a



Bits error versus b



Bits error versus c
if b < -1.8019041569772403e111Initial program 49.3
Taylor expanded in b around -inf 2.7
Applied neg-mul-1_binary642.7
Applied fma-neg_binary642.7
Simplified2.7
if -1.8019041569772403e111 < b < 6.1084100364959754e62Initial program 9.7
if 6.1084100364959754e62 < b Initial program 27.0
Taylor expanded in b around -inf 27.0
Taylor expanded in c around 0 4.0
Final simplification7.0
herbie shell --seed 2022063
(FPCore (a b c)
:name "jeff quadratic root 2"
:precision binary64
(if (>= b 0.0) (/ (* 2.0 c) (- (- b) (sqrt (- (* b b) (* (* 4.0 a) c))))) (/ (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a))))