\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.31978863796901832 \cdot 10^{93}:\\
\;\;\;\;-1 \cdot \frac{c}{b}\\
\mathbf{elif}\;b \le 1.51697235334777209 \cdot 10^{-296}:\\
\;\;\;\;{\left(\frac{2 \cdot c}{\sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)} - b}\right)}^{1}\\
\mathbf{elif}\;b \le 9.4786024504874866 \cdot 10^{81}:\\
\;\;\;\;\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 \frac{b}{a}\\
\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 <= -1.3197886379690183e+93)) {
VAR = (-1.0 * (c / b));
} else {
double VAR_1;
if ((b <= 1.516972353347772e-296)) {
VAR_1 = pow(((2.0 * c) / (sqrt(((b * b) - (4.0 * (a * c)))) - b)), 1.0);
} else {
double VAR_2;
if ((b <= 9.478602450487487e+81)) {
VAR_2 = ((-b - sqrt(((b * b) - (4.0 * (a * c))))) * (1.0 / (2.0 * a)));
} else {
VAR_2 = (-1.0 * (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.1 |
|---|---|
| Target | 20.5 |
| Herbie | 6.7 |
if b < -1.3197886379690183e+93Initial program 58.8
Taylor expanded around -inf 2.9
if -1.3197886379690183e+93 < b < 1.516972353347772e-296Initial program 31.0
rmApplied div-inv31.0
rmApplied flip--31.1
Simplified16.9
Simplified16.9
rmApplied pow116.9
Applied pow116.9
Applied pow-prod-down16.9
Simplified16.0
Taylor expanded around 0 9.2
if 1.516972353347772e-296 < b < 9.478602450487487e+81Initial program 8.5
rmApplied div-inv8.7
if 9.478602450487487e+81 < b Initial program 41.8
rmApplied div-inv41.9
rmApplied flip--62.9
Simplified62.1
Simplified62.1
Taylor expanded around 0 4.5
Final simplification6.7
herbie shell --seed 2020079
(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)))