author | Rodrigo Campos
<rodrigo@sdfg.com.ar> 2010-09-07 21:22:52 UTC |
committer | Rodrigo Campos
<rodrigo@sdfg.com.ar> 2010-09-08 02:15:04 UTC |
parent | cb17a69c5f1d3bb44c11dd7bc19fcc2a9b5dbaf6 |
binomial_dec.cpp | +5 | -3 |
diff --git a/binomial_dec.cpp b/binomial_dec.cpp index 25387cc..6791c64 100644 --- a/binomial_dec.cpp +++ b/binomial_dec.cpp @@ -42,9 +42,10 @@ int main(int argc, char *argv[]) list<numero> terminos; - /* Valor inicial, el del primer término */ + /* Ponemos el primer termino de la seie */ numero a_i(prec, 1); terminos.push_back(a_i); + /* Loop de la serie, nterm términos */ for (int i = 0; i < nterm; i++) { @@ -62,9 +63,10 @@ int main(int argc, char *argv[]) //printf(" %d %.60f 0x%" print_64t "x\n", i, n.to_double(), to_u64(n)); } - numero n(prec, 1); + numero n(prec, 0); list<numero>::iterator it; - for ( it=terminos.end() ; it != terminos.begin(); it--) + terminos.reverse(); + for (it=terminos.begin() ; it != terminos.end(); it++) n = n + *it; print_result(nterm, n);