\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 -2.302834620394509 \cdot 10^{+153}:\\
\;\;\;\;\frac{c}{b} - \frac{b}{a}\\
\mathbf{elif}\;b \leq 2.595266346017017 \cdot 10^{-294}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)}}{a \cdot 2} - \frac{b}{a \cdot 2}\\
\mathbf{elif}\;b \leq 2.382809818126237 \cdot 10^{+37}:\\
\;\;\;\;\frac{\frac{a \cdot \left(c \cdot -4\right)}{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 -2.302834620394509e+153)
(- (/ c b) (/ b a))
(if (<= b 2.595266346017017e-294)
(- (/ (sqrt (- (* b b) (* c (* a 4.0)))) (* a 2.0)) (/ b (* a 2.0)))
(if (<= b 2.382809818126237e+37)
(/
(/ (* a (* c -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 <= -2.302834620394509e+153) {
tmp = (c / b) - (b / a);
} else if (b <= 2.595266346017017e-294) {
tmp = (sqrt((b * b) - (c * (a * 4.0))) / (a * 2.0)) - (b / (a * 2.0));
} else if (b <= 2.382809818126237e+37) {
tmp = ((a * (c * -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 < -2.30283462039450885e153Initial program 63.7
Simplified63.7
Taylor expanded around -inf 2.4
if -2.30283462039450885e153 < b < 2.59526634601701712e-294Initial program 9.0
Simplified9.0
rmApplied div-sub_binary64_28119.0
if 2.59526634601701712e-294 < b < 2.38280981812623713e37Initial program 28.2
Simplified28.2
rmApplied flip--_binary64_278128.3
Simplified15.9
Simplified15.9
if 2.38280981812623713e37 < b Initial program 56.0
Simplified56.0
Taylor expanded around inf 4.7
Simplified4.7
Final simplification8.6
herbie shell --seed 2020342
(FPCore (a b c)
:name "Quadratic roots, full range"
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a)))