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




Bits error versus a




Bits error versus b




Bits error versus c
Results
| Original | 34.6 |
|---|---|
| Target | 21.6 |
| Herbie | 19.1 |
if b < -1.2020858296199258e-268Initial program 45.8
rmApplied flip--_binary6445.8
Simplified23.9
Simplified23.9
rmApplied *-un-lft-identity_binary6423.9
Applied *-un-lft-identity_binary6423.9
Applied distribute-lft-out--_binary6423.9
Applied times-frac_binary6423.9
Applied times-frac_binary6423.9
Simplified23.9
rmApplied *-un-lft-identity_binary6423.9
Applied *-un-lft-identity_binary6423.9
Applied distribute-lft-out--_binary6423.9
Applied times-frac_binary6422.3
Simplified22.3
rmApplied clear-num_binary6422.5
Simplified18.8
if -1.2020858296199258e-268 < b < 1.3233476909814753e154Initial program 9.6
rmApplied div-sub_binary649.6
Simplified9.6
Simplified9.6
if 1.3233476909814753e154 < b Initial program 64.0
Taylor expanded around inf 52.2
Final simplification19.1
herbie shell --seed 2020285
(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)))