\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.4767676629755074 \cdot 10^{150}:\\
\;\;\;\;-1 \cdot \frac{c}{b}\\
\mathbf{elif}\;b \le -9.7864508816148999 \cdot 10^{-248}:\\
\;\;\;\;\frac{1}{2} \cdot \frac{4 \cdot c}{\sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)} - b}\\
\mathbf{elif}\;b \le 8.29347910705948456 \cdot 10^{98}:\\
\;\;\;\;\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.4767676629755074e+150)) {
temp = (-1.0 * (c / b));
} else {
double temp_1;
if ((b <= -9.7864508816149e-248)) {
temp_1 = ((1.0 / 2.0) * ((4.0 * c) / (sqrt(((b * b) - (4.0 * (a * c)))) - b)));
} else {
double temp_2;
if ((b <= 8.293479107059485e+98)) {
temp_2 = ((-b / (2.0 * a)) - (sqrt(((b * b) - (4.0 * (a * c)))) / (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.2 |
|---|---|
| Target | 21.5 |
| Herbie | 6.6 |
if b < -4.4767676629755074e+150Initial program 63.7
Taylor expanded around -inf 1.4
if -4.4767676629755074e+150 < b < -9.7864508816149e-248Initial program 36.5
rmApplied flip--36.5
Simplified16.2
Simplified16.2
rmApplied *-un-lft-identity16.2
Applied *-un-lft-identity16.2
Applied times-frac16.2
Applied times-frac16.2
Simplified16.2
Simplified14.2
rmApplied *-un-lft-identity14.2
Applied times-frac14.2
Simplified14.2
Simplified7.3
if -9.7864508816149e-248 < b < 8.293479107059485e+98Initial program 10.0
rmApplied div-sub10.0
if 8.293479107059485e+98 < b Initial program 46.8
Taylor expanded around inf 3.8
Simplified3.8
Final simplification6.6
herbie shell --seed 2020060
(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)))