\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 -8.207773183877872 \cdot 10^{+151}:\\
\;\;\;\;-0.5 \cdot \left(2 \cdot \frac{c}{b}\right)\\
\mathbf{elif}\;b \leq -5.026239265453532 \cdot 10^{-290}:\\
\;\;\;\;-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 6.876785701482238 \cdot 10^{+44}:\\
\;\;\;\;-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 -8.207773183877872e+151)
(* -0.5 (* 2.0 (/ c b)))
(if (<= b -5.026239265453532e-290)
(* -0.5 (* 4.0 (/ c (- b (sqrt (- (* b b) (* 4.0 (* c a))))))))
(if (<= b 6.876785701482238e+44)
(* -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 <= -8.207773183877872e+151) {
tmp = -0.5 * (2.0 * (c / b));
} else if (b <= -5.026239265453532e-290) {
tmp = -0.5 * (4.0 * (c / (b - sqrt((b * b) - (4.0 * (c * a))))));
} else if (b <= 6.876785701482238e+44) {
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.8 |
|---|---|
| Target | 21.0 |
| Herbie | 6.6 |
if b < -8.20777318387787171e151Initial program 63.8
Simplified63.8
Taylor expanded around -inf 1.6
if -8.20777318387787171e151 < b < -5.0262392654535319e-290Initial program 35.5
Simplified35.5
rmApplied flip-+_binary64_72535.5
Simplified15.5
rmApplied *-un-lft-identity_binary64_75115.5
Applied *-un-lft-identity_binary64_75115.5
Applied times-frac_binary64_75715.5
Applied times-frac_binary64_75715.5
Simplified15.5
Simplified7.3
if -5.0262392654535319e-290 < b < 6.8767857014822378e44Initial program 9.8
Simplified9.8
rmApplied clear-num_binary64_75010.0
if 6.8767857014822378e44 < b Initial program 38.7
Simplified38.7
Taylor expanded around inf 5.7
Simplified5.7
Final simplification6.6
herbie shell --seed 2020299
(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)))