\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{2 \cdot c}{b \cdot -2}\\
\mathbf{if}\;b \leq -3.422318262370561 \cdot 10^{+152}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{b \cdot -2}{2 \cdot a}\\
\end{array}\\
\mathbf{elif}\;b \leq 5.577999191242217 \cdot 10^{+93}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{2 \cdot c}{-\left(b + \sqrt{b \cdot b - 4 \cdot \left(c \cdot a\right)}\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)} - b}{2 \cdot a}\\
\end{array}\\
\mathbf{elif}\;b \geq 0:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(\left(c \cdot a\right) \cdot \frac{2}{b} - b\right) - b}{2 \cdot a}\\
\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 (/ (* 2.0 c) (* b -2.0))))
(if (<= b -3.422318262370561e+152)
(if (>= b 0.0) t_0 (/ (* b -2.0) (* 2.0 a)))
(if (<= b 5.577999191242217e+93)
(if (>= b 0.0)
(/ (* 2.0 c) (- (+ b (sqrt (- (* b b) (* 4.0 (* c a)))))))
(/ (- (sqrt (- (* b b) (* c (* a 4.0)))) b) (* 2.0 a)))
(if (>= b 0.0) t_0 (/ (- (- (* (* c a) (/ 2.0 b)) b) b) (* 2.0 a)))))))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 = (2.0 * c) / (b * -2.0);
double tmp_1;
if (b <= -3.422318262370561e+152) {
double tmp_2;
if (b >= 0.0) {
tmp_2 = t_0;
} else {
tmp_2 = (b * -2.0) / (2.0 * a);
}
tmp_1 = tmp_2;
} else if (b <= 5.577999191242217e+93) {
double tmp_3;
if (b >= 0.0) {
tmp_3 = (2.0 * c) / -(b + sqrt((b * b) - (4.0 * (c * a))));
} else {
tmp_3 = (sqrt((b * b) - (c * (a * 4.0))) - b) / (2.0 * a);
}
tmp_1 = tmp_3;
} else if (b >= 0.0) {
tmp_1 = t_0;
} else {
tmp_1 = ((((c * a) * (2.0 / b)) - b) - b) / (2.0 * a);
}
return tmp_1;
}



Bits error versus a



Bits error versus b



Bits error versus c
Results
if b < -3.4223182623705609e152Initial program 63.5
Taylor expanded around inf 63.5
Simplified63.5
Taylor expanded around -inf 2.2
Simplified2.2
if -3.4223182623705609e152 < b < 5.57799919124221724e93Initial program 9.0
rmApplied neg-sub0_binary649.0
Applied associate--l-_binary649.0
Simplified9.0
if 5.57799919124221724e93 < b Initial program 28.9
Taylor expanded around inf 3.2
Simplified3.2
rmApplied add-cube-cbrt_binary643.2
Simplified3.2
Simplified3.2
Taylor expanded around -inf 3.2
Simplified3.2
Final simplification6.8
herbie shell --seed 2021202
(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))))