\frac{\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a}\begin{array}{l}
\mathbf{if}\;b \leq -6.161738829450185 \cdot 10^{+153}:\\
\;\;\;\;-0.5 \cdot \left(2 \cdot \frac{c}{b}\right)\\
\mathbf{elif}\;b \leq 1.715311830575204 \cdot 10^{-291}:\\
\;\;\;\;-0.5 \cdot \left(4 \cdot \frac{c}{b - \sqrt{b \cdot b - 4 \cdot \left(c \cdot a\right)}}\right)\\
\mathbf{elif}\;b \leq 1.1846201307114041 \cdot 10^{+94}:\\
\;\;\;\;-0.5 \cdot \frac{1}{\frac{a}{b + \sqrt{b \cdot b - 4 \cdot \left(c \cdot a\right)}}}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \left(2 \cdot \left(\frac{b}{a} - \frac{c}{b}\right)\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 -6.161738829450185e+153)
(* -0.5 (* 2.0 (/ c b)))
(if (<= b 1.715311830575204e-291)
(* -0.5 (* 4.0 (/ c (- b (sqrt (- (* b b) (* 4.0 (* c a))))))))
(if (<= b 1.1846201307114041e+94)
(* -0.5 (/ 1.0 (/ a (+ b (sqrt (- (* b b) (* 4.0 (* c a))))))))
(* -0.5 (* 2.0 (- (/ b 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 <= -6.161738829450185e+153) {
tmp = -0.5 * (2.0 * (c / b));
} else if (b <= 1.715311830575204e-291) {
tmp = -0.5 * (4.0 * (c / (b - sqrt((b * b) - (4.0 * (c * a))))));
} else if (b <= 1.1846201307114041e+94) {
tmp = -0.5 * (1.0 / (a / (b + sqrt((b * b) - (4.0 * (c * a))))));
} else {
tmp = -0.5 * (2.0 * ((b / a) - (c / b)));
}
return tmp;
}




Bits error versus a




Bits error versus b




Bits error versus c
Results
| Original | 34.5 |
|---|---|
| Target | 21.1 |
| Herbie | 6.9 |
if b < -6.1617388294501852e153Initial program 63.8
Simplified63.8
Taylor expanded around -inf 1.7
if -6.1617388294501852e153 < b < 1.71531183057520417e-291Initial program 34.9
Simplified34.9
rmApplied flip-+_binary6434.9
Simplified16.3
rmApplied *-un-lft-identity_binary6416.3
Applied *-un-lft-identity_binary6416.3
Applied times-frac_binary6416.3
Applied times-frac_binary6416.3
Simplified16.3
Simplified8.1
if 1.71531183057520417e-291 < b < 1.1846201307114041e94Initial program 9.7
Simplified9.7
rmApplied clear-num_binary649.8
if 1.1846201307114041e94 < b Initial program 45.4
Simplified45.4
Taylor expanded around inf 4.7
Simplified4.7
Final simplification6.9
herbie shell --seed 2020253
(FPCore (a b c)
:name "quadm (p42, negative)"
:precision binary64
:herbie-expected #f
:herbie-target
(if (< b 0.0) (/ c (* a (/ (+ (- b) (sqrt (- (* b b) (* 4.0 (* a c))))) (* 2.0 a)))) (/ (- (- b) (sqrt (- (* b b) (* 4.0 (* a c))))) (* 2.0 a)))
(/ (- (- b) (sqrt (- (* b b) (* 4.0 (* a c))))) (* 2.0 a)))