\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.6236541306877014 \cdot 10^{+56}:\\
\;\;\;\;\frac{2 \cdot \left(\frac{a \cdot c}{b} - b\right)}{2 \cdot a}\\
\mathbf{elif}\;b \leq 7.131198222427231 \cdot 10^{-227}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)} - b}{2 \cdot a}\\
\mathbf{elif}\;b \leq 5.525835260688754 \cdot 10^{+121}:\\
\;\;\;\;\frac{1}{\frac{0.5}{\frac{c}{\left(-b\right) - \sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)}}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{0.5}{\frac{c}{2 \cdot \left(\frac{a \cdot c}{b} - b\right)}}}\\
\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.6236541306877014e+56)
(/ (* 2.0 (- (/ (* a c) b) b)) (* 2.0 a))
(if (<= b 7.131198222427231e-227)
(/ (- (sqrt (- (* b b) (* c (* a 4.0)))) b) (* 2.0 a))
(if (<= b 5.525835260688754e+121)
(/ 1.0 (/ 0.5 (/ c (- (- b) (sqrt (- (* b b) (* c (* a 4.0))))))))
(/ 1.0 (/ 0.5 (/ c (* 2.0 (- (/ (* a c) b) 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.6236541306877014e+56) {
tmp = (2.0 * (((a * c) / b) - b)) / (2.0 * a);
} else if (b <= 7.131198222427231e-227) {
tmp = (sqrt((b * b) - (c * (a * 4.0))) - b) / (2.0 * a);
} else if (b <= 5.525835260688754e+121) {
tmp = 1.0 / (0.5 / (c / (-b - sqrt((b * b) - (c * (a * 4.0))))));
} else {
tmp = 1.0 / (0.5 / (c / (2.0 * (((a * c) / b) - b))));
}
return tmp;
}



Bits error versus a



Bits error versus b



Bits error versus c
Results
if b < -1.6236541306877014e56Initial program 38.1
Taylor expanded around -inf 11.2
Simplified11.2
if -1.6236541306877014e56 < b < 7.131198222427231e-227Initial program 10.2
if 7.131198222427231e-227 < b < 5.52583526068875372e121Initial program 36.8
rmApplied flip-+_binary64_39736.8
Simplified17.1
rmApplied associate-/r*_binary64_36717.1
Simplified14.4
rmApplied clear-num_binary64_42214.7
Simplified7.6
if 5.52583526068875372e121 < b Initial program 61.3
rmApplied flip-+_binary64_39761.3
Simplified34.4
rmApplied associate-/r*_binary64_36734.4
Simplified34.2
rmApplied clear-num_binary64_42234.2
Simplified32.8
Taylor expanded around inf 6.2
Simplified6.2
Final simplification8.9
herbie shell --seed 2020281
(FPCore (a b c)
:name "Quadratic roots, full range"
:precision binary64
(/ (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a)))