\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}
\mathbf{if}\;b \leq -4.1275090717025735 \cdot 10^{+127}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;2 \cdot \frac{c}{\left(2 \cdot \left(c \cdot \frac{a}{b}\right) - b\right) - b}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(c \cdot \left(2 \cdot \frac{a}{b}\right) - b\right) - b}{2 \cdot a}\\
\end{array}\\
\mathbf{elif}\;b \leq -2.780192689850507 \cdot 10^{-300}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;2 \cdot \frac{c}{\frac{c \cdot \left(a \cdot 4\right)}{\sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)} - b}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)} - b}{2 \cdot a}\\
\end{array}\\
\mathbf{elif}\;b \leq 2.838341990170196 \cdot 10^{+126}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;2 \cdot \frac{c}{\left(-b\right) - \sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)}}\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{\log \left(\left(2 \cdot \frac{c \cdot a}{b} - b\right) - b\right)}}{2 \cdot a}\\
\end{array}\\
\mathbf{elif}\;b \geq 0:\\
\;\;\;\;2 \cdot \frac{c}{\left(2 \cdot \left(c \cdot \frac{a}{b}\right) - b\right) - b}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(c \cdot \left(2 \cdot \frac{a}{b}\right) - 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
(if (<= b -4.1275090717025735e+127)
(if (>= b 0.0)
(* 2.0 (/ c (- (- (* 2.0 (* c (/ a b))) b) b)))
(/ (- (- (* c (* 2.0 (/ a b))) b) b) (* 2.0 a)))
(if (<= b -2.780192689850507e-300)
(if (>= b 0.0)
(*
2.0
(/ c (/ (* c (* a 4.0)) (- (sqrt (- (* b b) (* c (* a 4.0)))) b))))
(/ (- (sqrt (- (* b b) (* c (* a 4.0)))) b) (* 2.0 a)))
(if (<= b 2.838341990170196e+126)
(if (>= b 0.0)
(* 2.0 (/ c (- (- b) (sqrt (- (* b b) (* c (* a 4.0)))))))
(/ (exp (log (- (- (* 2.0 (/ (* c a) b)) b) b))) (* 2.0 a)))
(if (>= b 0.0)
(* 2.0 (/ c (- (- (* 2.0 (* c (/ a b))) b) b)))
(/ (- (- (* c (* 2.0 (/ a b))) b) b) (* 2.0 a)))))))double code(double a, double b, double c) {
double tmp;
if ((b >= 0.0)) {
tmp = (((double) (2.0 * c)) / ((double) (((double) -(b)) - ((double) sqrt(((double) (((double) (b * b)) - ((double) (((double) (4.0 * a)) * c)))))))));
} else {
tmp = (((double) (((double) -(b)) + ((double) sqrt(((double) (((double) (b * b)) - ((double) (((double) (4.0 * a)) * c)))))))) / ((double) (2.0 * a)));
}
return tmp;
}
double code(double a, double b, double c) {
double tmp;
if ((b <= -4.1275090717025735e+127)) {
double tmp_1;
if ((b >= 0.0)) {
tmp_1 = ((double) (2.0 * (c / ((double) (((double) (((double) (2.0 * ((double) (c * (a / b))))) - b)) - b)))));
} else {
tmp_1 = (((double) (((double) (((double) (c * ((double) (2.0 * (a / b))))) - b)) - b)) / ((double) (2.0 * a)));
}
tmp = tmp_1;
} else {
double tmp_2;
if ((b <= -2.780192689850507e-300)) {
double tmp_3;
if ((b >= 0.0)) {
tmp_3 = ((double) (2.0 * (c / (((double) (c * ((double) (a * 4.0)))) / ((double) (((double) sqrt(((double) (((double) (b * b)) - ((double) (c * ((double) (a * 4.0)))))))) - b))))));
} else {
tmp_3 = (((double) (((double) sqrt(((double) (((double) (b * b)) - ((double) (c * ((double) (a * 4.0)))))))) - b)) / ((double) (2.0 * a)));
}
tmp_2 = tmp_3;
} else {
double tmp_4;
if ((b <= 2.838341990170196e+126)) {
double tmp_5;
if ((b >= 0.0)) {
tmp_5 = ((double) (2.0 * (c / ((double) (((double) -(b)) - ((double) sqrt(((double) (((double) (b * b)) - ((double) (c * ((double) (a * 4.0)))))))))))));
} else {
tmp_5 = (((double) exp(((double) log(((double) (((double) (((double) (2.0 * (((double) (c * a)) / b))) - b)) - b)))))) / ((double) (2.0 * a)));
}
tmp_4 = tmp_5;
} else {
double tmp_6;
if ((b >= 0.0)) {
tmp_6 = ((double) (2.0 * (c / ((double) (((double) (((double) (2.0 * ((double) (c * (a / b))))) - b)) - b)))));
} else {
tmp_6 = (((double) (((double) (((double) (c * ((double) (2.0 * (a / b))))) - b)) - b)) / ((double) (2.0 * a)));
}
tmp_4 = tmp_6;
}
tmp_2 = tmp_4;
}
tmp = tmp_2;
}
return tmp;
}



Bits error versus a



Bits error versus b



Bits error versus c
Results
if b < -4.12750907170257349e127 or 2.83834199017019573e126 < b Initial program Error: 42.0 bits
SimplifiedError: 42.0 bits
Taylor expanded around inf Error: 25.0 bits
SimplifiedError: 22.4 bits
Taylor expanded around -inf Error: 5.2 bits
SimplifiedError: 2.5 bits
if -4.12750907170257349e127 < b < -2.78019268985050695e-300Initial program Error: 8.8 bits
SimplifiedError: 8.8 bits
rmApplied flip--Error: 8.8 bits
SimplifiedError: 8.8 bits
SimplifiedError: 8.8 bits
if -2.78019268985050695e-300 < b < 2.83834199017019573e126Initial program Error: 8.7 bits
SimplifiedError: 8.7 bits
rmApplied add-exp-logError: 8.8 bits
Taylor expanded around -inf Error: 9.2 bits
SimplifiedError: 9.2 bits
rmApplied associate-*r/Error: 9.2 bits
Final simplificationError: 6.9 bits
herbie shell --seed 2020204
(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))))