\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 -2.40284932349203652 \cdot 10^{128}:\\
\;\;\;\;-1 \cdot \frac{c}{b}\\
\mathbf{elif}\;b \le 5.877669040907696 \cdot 10^{-167}:\\
\;\;\;\;{\left(\frac{2 \cdot c}{\sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)} - b}\right)}^{1}\\
\mathbf{elif}\;b \le 1.58497213944565541 \cdot 10^{84}:\\
\;\;\;\;\frac{\left(-b\right) - \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 <= -2.4028493234920365e+128)) {
temp = (-1.0 * (c / b));
} else {
double temp_1;
if ((b <= 5.877669040907696e-167)) {
temp_1 = pow(((2.0 * c) / (sqrt(((b * b) - (4.0 * (a * c)))) - b)), 1.0);
} else {
double temp_2;
if ((b <= 1.5849721394456554e+84)) {
temp_2 = ((-b - 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.2 |
| Herbie | 6.8 |
if b < -2.4028493234920365e+128Initial program 61.5
Taylor expanded around -inf 2.2
if -2.4028493234920365e+128 < b < 5.877669040907696e-167Initial program 29.5
rmApplied div-inv29.6
rmApplied flip--29.8
Simplified16.1
Simplified16.1
rmApplied pow116.1
Applied pow116.1
Applied pow-prod-down16.1
Simplified15.0
Taylor expanded around 0 10.0
if 5.877669040907696e-167 < b < 1.5849721394456554e+84Initial program 7.0
if 1.5849721394456554e+84 < b Initial program 43.1
Taylor expanded around inf 4.1
Simplified4.1
Final simplification6.8
herbie shell --seed 2020056
(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)))