\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 -5.785370549652638 \cdot 10^{+71}:\\
\;\;\;\;\frac{c}{b} - \frac{b}{a}\\
\mathbf{elif}\;b \leq -5.904324843765853 \cdot 10^{-289}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)} - b}{a \cdot 2}\\
\mathbf{elif}\;b \leq 8.333589530494835 \cdot 10^{+96}:\\
\;\;\;\;-2 \cdot \frac{c}{b + \sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)}}\\
\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 -5.785370549652638e+71)
(- (/ c b) (/ b a))
(if (<= b -5.904324843765853e-289)
(/ (- (sqrt (- (* b b) (* c (* a 4.0)))) b) (* a 2.0))
(if (<= b 8.333589530494835e+96)
(* -2.0 (/ c (+ b (sqrt (- (* b b) (* c (* a 4.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 <= -5.785370549652638e+71) {
tmp = (c / b) - (b / a);
} else if (b <= -5.904324843765853e-289) {
tmp = (sqrt((b * b) - (c * (a * 4.0))) - b) / (a * 2.0);
} else if (b <= 8.333589530494835e+96) {
tmp = -2.0 * (c / (b + sqrt((b * b) - (c * (a * 4.0)))));
} else {
tmp = -(c / b);
}
return tmp;
}



Bits error versus a



Bits error versus b



Bits error versus c
Results
if b < -5.78537054965263775e71Initial program 41.7
Simplified41.7
Taylor expanded around -inf 4.3
if -5.78537054965263775e71 < b < -5.9043248437658527e-289Initial program 9.1
Simplified9.1
if -5.9043248437658527e-289 < b < 8.33358953049483488e96Initial program 31.7
Simplified31.7
rmApplied flip--_binary64_39831.7
Simplified16.7
Simplified16.7
rmApplied *-un-lft-identity_binary64_42316.7
Applied times-frac_binary64_42914.4
Applied times-frac_binary64_4299.4
Simplified9.4
Simplified9.4
if 8.33358953049483488e96 < b Initial program 59.5
Simplified59.5
Taylor expanded around inf 2.6
Simplified2.6
Final simplification6.8
herbie shell --seed 2020277
(FPCore (a b c)
:name "Quadratic roots, full range"
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a)))