\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 -3.87384383054274148 \cdot 10^{112}:\\
\;\;\;\;-1 \cdot \frac{c}{b}\\
\mathbf{elif}\;b \le 1.4997509575725276 \cdot 10^{-267}:\\
\;\;\;\;\frac{2 \cdot c}{\left(-b\right) + \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}\\
\mathbf{elif}\;b \le 1.30179762345334763 \cdot 10^{80}:\\
\;\;\;\;\frac{{\left(\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}\right)}^{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 temp;
if ((b <= -3.8738438305427415e+112)) {
temp = (-1.0 * (c / b));
} else {
double temp_1;
if ((b <= 1.4997509575725276e-267)) {
temp_1 = ((2.0 * c) / (-b + sqrt(((b * b) - (4.0 * (a * c))))));
} else {
double temp_2;
if ((b <= 1.3017976234533476e+80)) {
temp_2 = (pow((-b - sqrt(((b * b) - (4.0 * (a * c))))), 1.0) / (2.0 * a));
} else {
temp_2 = (1.0 * ((c / b) - (b / a)));
}
temp_1 = temp_2;
}
temp = temp_1;
}
return temp;
}




Bits error versus a




Bits error versus b




Bits error versus c
Results
| Original | 34.1 |
|---|---|
| Target | 20.5 |
| Herbie | 6.2 |
if b < -3.8738438305427415e+112Initial program 61.0
Taylor expanded around -inf 2.7
if -3.8738438305427415e+112 < b < 1.4997509575725276e-267Initial program 30.9
rmApplied div-inv30.9
rmApplied flip--30.9
Applied associate-*l/31.0
Simplified14.6
Taylor expanded around 0 8.5
if 1.4997509575725276e-267 < b < 1.3017976234533476e+80Initial program 7.9
rmApplied pow17.9
if 1.3017976234533476e+80 < b Initial program 43.3
Taylor expanded around inf 3.9
Simplified3.9
Final simplification6.2
herbie shell --seed 2020058
(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)))