\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 -1.065456673131415 \cdot 10^{+146}:\\
\;\;\;\;\frac{c}{b} - \frac{b}{a}\\
\mathbf{elif}\;b \leq -2.0268161128108735 \cdot 10^{-255}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)}}{a \cdot 2} - \frac{b}{a \cdot 2}\\
\mathbf{elif}\;b \leq 5.069643829098221 \cdot 10^{+75}:\\
\;\;\;\;-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 -1.065456673131415e+146)
(- (/ c b) (/ b a))
(if (<= b -2.0268161128108735e-255)
(- (/ (sqrt (- (* b b) (* c (* a 4.0)))) (* a 2.0)) (/ b (* a 2.0)))
(if (<= b 5.069643829098221e+75)
(* -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 <= -1.065456673131415e+146) {
tmp = (c / b) - (b / a);
} else if (b <= -2.0268161128108735e-255) {
tmp = (sqrt((b * b) - (c * (a * 4.0))) / (a * 2.0)) - (b / (a * 2.0));
} else if (b <= 5.069643829098221e+75) {
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 < -1.065456673131415e146Initial program 61.2
Simplified61.2
Taylor expanded around -inf 2.4
if -1.065456673131415e146 < b < -2.026816112810873e-255Initial program 8.2
Simplified8.2
rmApplied div-sub_binary648.2
if -2.026816112810873e-255 < b < 5.0696438290982213e75Initial program 28.6
Simplified28.6
rmApplied flip--_binary6428.7
Simplified16.1
Simplified16.1
rmApplied *-un-lft-identity_binary6416.1
Applied times-frac_binary6414.0
Applied times-frac_binary649.1
Simplified9.1
Simplified9.0
if 5.0696438290982213e75 < b Initial program 58.4
Simplified58.4
Taylor expanded around inf 3.5
Simplified3.5
Final simplification6.5
herbie shell --seed 2020268
(FPCore (a b c)
:name "Quadratic roots, full range"
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a)))