\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 -4.01157973271056712 \cdot 10^{-81}:\\
\;\;\;\;-1 \cdot \frac{c}{b}\\
\mathbf{elif}\;b \le 1.3176462918432122 \cdot 10^{99}:\\
\;\;\;\;\frac{-b}{2 \cdot a} - \frac{\sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{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 <= -4.011579732710567e-81)) {
temp = (-1.0 * (c / b));
} else {
double temp_1;
if ((b <= 1.3176462918432122e+99)) {
temp_1 = ((-b / (2.0 * a)) - (sqrt(((b * b) - (4.0 * (a * c)))) / (2.0 * a)));
} else {
temp_1 = (1.0 * ((c / b) - (b / a)));
}
temp = temp_1;
}
return temp;
}




Bits error versus a




Bits error versus b




Bits error versus c
Results
| Original | 34.2 |
|---|---|
| Target | 21.5 |
| Herbie | 10.0 |
if b < -4.011579732710567e-81Initial program 52.8
Taylor expanded around -inf 9.4
if -4.011579732710567e-81 < b < 1.3176462918432122e+99Initial program 12.9
rmApplied div-sub12.9
if 1.3176462918432122e+99 < b Initial program 46.8
Taylor expanded around inf 3.8
Simplified3.8
Final simplification10.0
herbie shell --seed 2020060 +o rules:numerics
(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)))