\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.4270058556435274 \cdot 10^{-117}:\\
\;\;\;\;1 \cdot \left(-1 \cdot \frac{c}{b}\right)\\
\mathbf{elif}\;b \le 2.49922826628406174 \cdot 10^{84}:\\
\;\;\;\;1 \cdot \frac{1}{\frac{2 \cdot a}{\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}}\\
\mathbf{else}:\\
\;\;\;\;1 \cdot \left(1 \cdot \left(\frac{c}{b} - \frac{b}{a}\right)\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.4270058556435274e-117)) {
temp = (1.0 * (-1.0 * (c / b)));
} else {
double temp_1;
if ((b <= 2.4992282662840617e+84)) {
temp_1 = (1.0 * (1.0 / ((2.0 * a) / (-b - sqrt(((b * b) - (4.0 * (a * c))))))));
} else {
temp_1 = (1.0 * (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.2 |
| Herbie | 10.5 |
if b < -4.4270058556435274e-117Initial program 51.5
rmApplied clear-num51.5
rmApplied *-un-lft-identity51.5
Applied add-cube-cbrt51.5
Applied times-frac51.5
Simplified51.5
Simplified51.5
Taylor expanded around -inf 11.1
if -4.4270058556435274e-117 < b < 2.4992282662840617e+84Initial program 12.4
rmApplied clear-num12.5
rmApplied *-un-lft-identity12.5
if 2.4992282662840617e+84 < b Initial program 43.2
rmApplied clear-num43.2
rmApplied *-un-lft-identity43.2
Applied add-cube-cbrt43.2
Applied times-frac43.2
Simplified43.2
Simplified43.2
Taylor expanded around inf 4.1
Simplified4.1
Final simplification10.5
herbie shell --seed 2020056 +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)))