\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 -5.2389466313579672 \cdot 10^{127}:\\
\;\;\;\;1 \cdot \left(\frac{c}{b} - \frac{b}{a}\right)\\
\mathbf{elif}\;b \le 7.17047858644702483 \cdot 10^{-264}:\\
\;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a}\\
\mathbf{elif}\;b \le 3.7711811459025421 \cdot 10^{84}:\\
\;\;\;\;1 \cdot \frac{\frac{1}{\frac{2}{4}}}{\frac{\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{c}}\\
\mathbf{else}:\\
\;\;\;\;-1 \cdot \frac{c}{b}\\
\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 <= -5.238946631357967e+127)) {
temp = (1.0 * ((c / b) - (b / a)));
} else {
double temp_1;
if ((b <= 7.170478586447025e-264)) {
temp_1 = ((-b + sqrt(((b * b) - (4.0 * (a * c))))) / (2.0 * a));
} else {
double temp_2;
if ((b <= 3.771181145902542e+84)) {
temp_2 = (1.0 * ((1.0 / (2.0 / 4.0)) / ((-b - sqrt(((b * b) - (4.0 * (a * c))))) / c)));
} else {
temp_2 = (-1.0 * (c / b));
}
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.6 |
| Herbie | 6.8 |
if b < -5.238946631357967e+127Initial program 54.2
Taylor expanded around -inf 3.3
Simplified3.3
if -5.238946631357967e+127 < b < 7.170478586447025e-264Initial program 8.9
if 7.170478586447025e-264 < b < 3.771181145902542e+84Initial program 34.1
rmApplied flip-+34.1
Simplified16.5
rmApplied *-un-lft-identity16.5
Applied *-un-lft-identity16.5
Applied times-frac16.5
Applied associate-/l*16.7
Simplified16.1
rmApplied times-frac16.1
Simplified9.7
rmApplied div-inv9.7
Simplified9.7
if 3.771181145902542e+84 < b Initial program 58.6
Taylor expanded around inf 2.9
Final simplification6.8
herbie shell --seed 2020056
(FPCore (a b c)
:name "quadp (p42, positive)"
:precision binary64
:herbie-target
(if (< b 0.0) (/ (+ (- b) (sqrt (- (* b b) (* 4 (* a c))))) (* 2 a)) (/ c (* a (/ (- (- b) (sqrt (- (* b b) (* 4 (* a c))))) (* 2 a)))))
(/ (+ (- b) (sqrt (- (* b b) (* 4 (* a c))))) (* 2 a)))