\frac{\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a}\begin{array}{l}
\mathbf{if}\;b \le -2.1863495131209921 \cdot 10^{48}:\\
\;\;\;\;-1 \cdot \frac{c}{b}\\
\mathbf{elif}\;b \le 8.40594418978702039 \cdot 10^{-269}:\\
\;\;\;\;\frac{4 \cdot c}{\left(2 \cdot a\right) \cdot \frac{\sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)} - b}{a}}\\
\mathbf{elif}\;b \le 1.6809283377365093 \cdot 10^{101}:\\
\;\;\;\;\left(\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}\right) \cdot \frac{1}{2 \cdot a}\\
\mathbf{else}:\\
\;\;\;\;1 \cdot \left(\frac{c}{b} - \frac{b}{a}\right)\\
\end{array}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 VAR;
if ((b <= -2.186349513120992e+48)) {
VAR = (-1.0 * (c / b));
} else {
double VAR_1;
if ((b <= 8.40594418978702e-269)) {
VAR_1 = ((4.0 * c) / ((2.0 * a) * ((sqrt(((b * b) - (4.0 * (a * c)))) - b) / a)));
} else {
double VAR_2;
if ((b <= 1.6809283377365093e+101)) {
VAR_2 = ((-b - sqrt(((b * b) - (4.0 * (a * c))))) * (1.0 / (2.0 * a)));
} else {
VAR_2 = (1.0 * ((c / b) - (b / a)));
}
VAR_1 = VAR_2;
}
VAR = VAR_1;
}
return VAR;
}




Bits error versus a




Bits error versus b




Bits error versus c
Results
| Original | 33.8 |
|---|---|
| Target | 20.6 |
| Herbie | 7.0 |
if b < -2.186349513120992e+48Initial program 57.3
Taylor expanded around -inf 4.0
if -2.186349513120992e+48 < b < 8.40594418978702e-269Initial program 27.5
rmApplied flip--27.5
Simplified16.0
Simplified16.0
rmApplied *-commutative16.0
Applied associate-*r*16.0
Applied associate-/l*14.0
Applied associate-/l/9.8
if 8.40594418978702e-269 < b < 1.6809283377365093e+101Initial program 9.0
rmApplied div-inv9.2
if 1.6809283377365093e+101 < b Initial program 47.2
Taylor expanded around inf 3.5
Simplified3.5
Final simplification7.0
herbie shell --seed 2020078
(FPCore (a b c)
:name "quadm (p42, negative)"
:precision binary64
:herbie-target
(if (< b 0.0) (/ c (* a (/ (+ (- b) (sqrt (- (* b b) (* 4 (* a c))))) (* 2 a)))) (/ (- (- b) (sqrt (- (* b b) (* 4 (* a c))))) (* 2 a)))
(/ (- (- b) (sqrt (- (* b b) (* 4 (* a c))))) (* 2 a)))