\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\
\mathbf{else}:\\
\;\;\;\;\frac{2 \cdot c}{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\\
\end{array}
\begin{array}{l}
t_0 := \sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)}\\
\mathbf{if}\;b \leq -9.602324171183254 \cdot 10^{+93}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;-0.5 \cdot \frac{b + t_0}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{c \cdot 2}{\left(-b\right) - b}\\
\end{array}\\
\mathbf{else}:\\
\;\;\;\;\begin{array}{l}
t_1 := \frac{c \cdot 2}{t_0 - b}\\
\mathbf{if}\;b \leq 1.8712767159114232 \cdot 10^{+66}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;-0.5 \cdot \frac{\mathsf{fma}\left(\sqrt{b}, \sqrt{b}, t_0\right)}{a}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}\\
\mathbf{elif}\;b \geq 0:\\
\;\;\;\;-0.5 \cdot \frac{b + b}{a}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}\\
\end{array}
(FPCore (a b c) :precision binary64 (if (>= b 0.0) (/ (- (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a)) (/ (* 2.0 c) (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))))))
(FPCore (a b c)
:precision binary64
(let* ((t_0 (sqrt (fma a (* c -4.0) (* b b)))))
(if (<= b -9.602324171183254e+93)
(if (>= b 0.0) (* -0.5 (/ (+ b t_0) a)) (/ (* c 2.0) (- (- b) b)))
(let* ((t_1 (/ (* c 2.0) (- t_0 b))))
(if (<= b 1.8712767159114232e+66)
(if (>= b 0.0) (* -0.5 (/ (fma (sqrt b) (sqrt b) t_0) a)) t_1)
(if (>= b 0.0) (* -0.5 (/ (+ b b) a)) t_1))))))double code(double a, double b, double c) {
double tmp;
if (b >= 0.0) {
tmp = (-b - sqrt((b * b) - ((4.0 * a) * c))) / (2.0 * a);
} else {
tmp = (2.0 * c) / (-b + sqrt((b * b) - ((4.0 * a) * c)));
}
return tmp;
}
double code(double a, double b, double c) {
double t_0 = sqrt(fma(a, (c * -4.0), (b * b)));
double tmp_1;
if (b <= -9.602324171183254e+93) {
double tmp_2;
if (b >= 0.0) {
tmp_2 = -0.5 * ((b + t_0) / a);
} else {
tmp_2 = (c * 2.0) / (-b - b);
}
tmp_1 = tmp_2;
} else {
double t_1 = (c * 2.0) / (t_0 - b);
double tmp_4;
if (b <= 1.8712767159114232e+66) {
double tmp_5;
if (b >= 0.0) {
tmp_5 = -0.5 * (fma(sqrt(b), sqrt(b), t_0) / a);
} else {
tmp_5 = t_1;
}
tmp_4 = tmp_5;
} else if (b >= 0.0) {
tmp_4 = -0.5 * ((b + b) / a);
} else {
tmp_4 = t_1;
}
tmp_1 = tmp_4;
}
return tmp_1;
}



Bits error versus a



Bits error versus b



Bits error versus c
if b < -9.60232417118325409e93Initial program 28.8
Simplified28.7
Taylor expanded in b around -inf 2.7
if -9.60232417118325409e93 < b < 1.87127671591142321e66Initial program 8.6
Simplified8.6
Applied add-sqr-sqrt_binary648.6
Applied fma-def_binary648.6
if 1.87127671591142321e66 < b Initial program 40.4
Simplified40.5
Taylor expanded in a around 0 5.3
Final simplification6.5
herbie shell --seed 2022068
(FPCore (a b c)
:name "jeff quadratic root 1"
:precision binary64
(if (>= b 0.0) (/ (- (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a)) (/ (* 2.0 c) (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))))))