\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 -1.338340640721482 \cdot 10^{+157}:\\
\;\;\;\;-0.5 \cdot \left(2 \cdot \frac{c}{b}\right)\\
\mathbf{elif}\;b \leq 3.0328686823891354 \cdot 10^{-294}:\\
\;\;\;\;-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 2.404688834790521 \cdot 10^{+51}:\\
\;\;\;\;-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 -1.338340640721482e+157)
(* -0.5 (* 2.0 (/ c b)))
(if (<= b 3.0328686823891354e-294)
(* -0.5 (* 4.0 (/ c (- b (sqrt (- (* b b) (* 4.0 (* c a))))))))
(if (<= b 2.404688834790521e+51)
(* -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 <= -1.338340640721482e+157) {
tmp = -0.5 * (2.0 * (c / b));
} else if (b <= 3.0328686823891354e-294) {
tmp = -0.5 * (4.0 * (c / (b - sqrt((b * b) - (4.0 * (c * a))))));
} else if (b <= 2.404688834790521e+51) {
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 | 33.9 |
|---|---|
| Target | 20.8 |
| Herbie | 6.5 |
if b < -1.33834064072148198e157Initial program 64.0
Simplified64.0
Taylor expanded around -inf 1.6
if -1.33834064072148198e157 < b < 3.0328686823891354e-294Initial program 33.5
Simplified33.5
rmApplied flip-+_binary64_39733.6
Simplified15.6
rmApplied *-un-lft-identity_binary64_42315.6
Applied *-un-lft-identity_binary64_42315.6
Applied times-frac_binary64_42915.6
Applied times-frac_binary64_42915.6
Simplified15.6
Simplified7.6
if 3.0328686823891354e-294 < b < 2.40468883479052089e51Initial program 9.3
Simplified9.3
rmApplied clear-num_binary64_4229.4
if 2.40468883479052089e51 < b Initial program 39.1
Simplified39.1
Taylor expanded around inf 5.2
Simplified5.2
Final simplification6.5
herbie shell --seed 2020280
(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)))