\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 -3.061643530149749 \cdot 10^{+106}:\\
\;\;\;\;\frac{c}{b} - \frac{b}{a}\\
\mathbf{elif}\;b \leq 2.4654087246385048 \cdot 10^{-119}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)}}{a \cdot 2} - \frac{b}{a \cdot 2}\\
\mathbf{elif}\;b \leq 3.480906013685845 \cdot 10^{+76}:\\
\;\;\;\;\left(\frac{c \cdot \left(a \cdot -4\right)}{b + \sqrt{b \cdot b - 4 \cdot \left(c \cdot a\right)}} \cdot \sqrt{0.5}\right) \cdot \frac{\sqrt{0.5}}{a}\\
\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 -3.061643530149749e+106)
(- (/ c b) (/ b a))
(if (<= b 2.4654087246385048e-119)
(- (/ (sqrt (- (* b b) (* c (* a 4.0)))) (* a 2.0)) (/ b (* a 2.0)))
(if (<= b 3.480906013685845e+76)
(*
(*
(/ (* c (* a -4.0)) (+ b (sqrt (- (* b b) (* 4.0 (* c a))))))
(sqrt 0.5))
(/ (sqrt 0.5) a))
(- (/ 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 <= -3.061643530149749e+106) {
tmp = (c / b) - (b / a);
} else if (b <= 2.4654087246385048e-119) {
tmp = (sqrt((b * b) - (c * (a * 4.0))) / (a * 2.0)) - (b / (a * 2.0));
} else if (b <= 3.480906013685845e+76) {
tmp = (((c * (a * -4.0)) / (b + sqrt((b * b) - (4.0 * (c * a))))) * sqrt(0.5)) * (sqrt(0.5) / a);
} else {
tmp = -(c / b);
}
return tmp;
}



Bits error versus a



Bits error versus b



Bits error versus c
Results
if b < -3.061643530149749e106Initial program 48.7
Simplified48.7
Taylor expanded around -inf 3.3
if -3.061643530149749e106 < b < 2.4654087246385048e-119Initial program 11.3
Simplified11.3
rmApplied div-sub_binary6411.3
if 2.4654087246385048e-119 < b < 3.4809060136858447e76Initial program 40.5
Simplified40.5
rmApplied div-inv_binary6440.5
Simplified40.5
rmApplied *-un-lft-identity_binary6440.5
Applied add-sqr-sqrt_binary6440.8
Applied times-frac_binary6440.7
Applied associate-*r*_binary6440.7
Simplified40.7
rmApplied flip--_binary6440.6
Simplified16.8
Simplified16.8
if 3.4809060136858447e76 < b Initial program 57.5
Simplified57.5
Taylor expanded around inf 3.4
Simplified3.4
Final simplification9.1
herbie shell --seed 2021198
(FPCore (a b c)
:name "Quadratic roots, full range"
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a)))