\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\begin{array}{l}
\mathbf{if}\;b \leq -4.270668456863539 \cdot 10^{+83}:\\
\;\;\;\;\frac{c}{b} - \frac{b}{a}\\
\mathbf{elif}\;b \leq 3.9440742229641566 \cdot 10^{-203}:\\
\;\;\;\;\frac{1}{\frac{a}{\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)} - b}{2}}}\\
\mathbf{elif}\;b \leq 2.2542282560766223 \cdot 10^{+78}:\\
\;\;\;\;\frac{\frac{\left(c \cdot a\right) \cdot -4}{b + \sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)}}}{a \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;-\frac{c}{b}\\
\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
(if (<= b -4.270668456863539e+83)
(- (/ c b) (/ b a))
(if (<= b 3.9440742229641566e-203)
(/ 1.0 (/ a (/ (- (sqrt (- (* b b) (* c (* a 4.0)))) b) 2.0)))
(if (<= b 2.2542282560766223e+78)
(/
(/ (* (* c a) -4.0) (+ b (sqrt (- (* b b) (* c (* a 4.0))))))
(* a 2.0))
(- (/ c b))))))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 tmp;
if (b <= -4.270668456863539e+83) {
tmp = (c / b) - (b / a);
} else if (b <= 3.9440742229641566e-203) {
tmp = 1.0 / (a / ((sqrt((b * b) - (c * (a * 4.0))) - b) / 2.0));
} else if (b <= 2.2542282560766223e+78) {
tmp = (((c * a) * -4.0) / (b + sqrt((b * b) - (c * (a * 4.0))))) / (a * 2.0);
} else {
tmp = -(c / b);
}
return tmp;
}



Bits error versus a



Bits error versus b



Bits error versus c
Results
if b < -4.27066845686353916e83Initial program 43.5
Simplified43.5
Taylor expanded around -inf 4.8
if -4.27066845686353916e83 < b < 3.9440742229641566e-203Initial program 11.3
Simplified11.3
rmApplied clear-num_binary6411.4
Simplified11.4
if 3.9440742229641566e-203 < b < 2.25422825607662234e78Initial program 37.0
Simplified37.0
rmApplied flip--_binary6437.0
Simplified17.0
Simplified17.0
if 2.25422825607662234e78 < b Initial program 58.1
Simplified58.1
Taylor expanded around inf 3.2
Simplified3.2
Final simplification9.4
herbie shell --seed 2020253
(FPCore (a b c)
:name "Quadratic roots, full range"
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a)))