\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 -1.3295118613703302 \cdot 10^{-13}:\\
\;\;\;\;-1 \cdot \frac{c}{b}\\
\mathbf{elif}\;b \le 3.29545095081340793 \cdot 10^{65}:\\
\;\;\;\;\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 temp;
if ((b <= -1.3295118613703302e-13)) {
temp = (-1.0 * (c / b));
} else {
double temp_1;
if ((b <= 3.295450950813408e+65)) {
temp_1 = ((-b - sqrt(((b * b) - (4.0 * (a * c))))) * (1.0 / (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 | 33.7 |
|---|---|
| Target | 21.0 |
| Herbie | 10.5 |
if b < -1.3295118613703302e-13Initial program 55.0
Taylor expanded around -inf 6.9
if -1.3295118613703302e-13 < b < 3.295450950813408e+65Initial program 15.4
rmApplied div-inv15.5
if 3.295450950813408e+65 < b Initial program 40.0
Taylor expanded around inf 4.7
Simplified4.7
Final simplification10.5
herbie shell --seed 2020057 +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)))