\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.3298367139250566 \cdot 10^{153}:\\
\;\;\;\;-1 \cdot \frac{c}{b}\\
\mathbf{elif}\;b \le 5.9493827268354929 \cdot 10^{-251}:\\
\;\;\;\;\frac{1}{\frac{\sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)} - b}{c} \cdot \frac{2}{4}}\\
\mathbf{elif}\;b \le 1.70350465332629402 \cdot 10^{111}:\\
\;\;\;\;\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 VAR;
if ((b <= -1.3298367139250566e+153)) {
VAR = (-1.0 * (c / b));
} else {
double VAR_1;
if ((b <= 5.949382726835493e-251)) {
VAR_1 = (1.0 / (((sqrt(((b * b) - (4.0 * (a * c)))) - b) / c) * (2.0 / 4.0)));
} else {
double VAR_2;
if ((b <= 1.703504653326294e+111)) {
VAR_2 = ((-b - sqrt(((b * b) - (4.0 * (a * c))))) * (1.0 / (2.0 * a)));
} else {
VAR_2 = (1.0 * ((c / b) - (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 | 34.0 |
|---|---|
| Target | 21.0 |
| Herbie | 6.6 |
if b < -1.3298367139250566e+153Initial program 63.9
Taylor expanded around -inf 1.7
if -1.3298367139250566e+153 < b < 5.949382726835493e-251Initial program 32.8
rmApplied flip--32.8
Simplified15.8
Simplified15.8
rmApplied associate-*r*15.8
Applied associate-/l*14.2
rmApplied clear-num14.2
Simplified8.8
if 5.949382726835493e-251 < b < 1.703504653326294e+111Initial program 8.4
rmApplied div-inv8.6
if 1.703504653326294e+111 < b Initial program 49.5
Taylor expanded around inf 3.0
Simplified3.0
Final simplification6.6
herbie shell --seed 2020071
(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)))