Skip to content
Browse files

start step index at 0 istead of one

  • Loading branch information...
1 parent 7871f44 commit ff6085a06bdc8d7d7eab73ae903177089d282803 @scientific-coder committed Jul 22, 2011
Showing with 2 additions and 2 deletions.
  1. +1 −1 src/cxx0x-montecarlo.cxx
  2. +1 −1 src/openmp-montecarlo.cxx
View
2 src/cxx0x-montecarlo.cxx
@@ -42,7 +42,7 @@ struct montecarlo_pricing {
// we take the engine as parameter to be thread safe : the engine will be thread-private
template<typename G>
double step(double s, G& g)const{
- for(int i(1); i != n_steps; ++i)
+ for(int i(0); i != n_steps; ++i)
{ s*= 1. + g()*std::sqrt(years_to_maturity/n_steps)
+ risk_free_rate* years_to_maturity/n_steps ; }
return s;
View
2 src/openmp-montecarlo.cxx
@@ -39,7 +39,7 @@ struct montecarlo_pricing {
// we take the engine as parameter to be thread safe : the engine will be thread-private
template<typename G>
double step(double s, G& g)const{
- for(int i(1); i != n_steps; ++i)
+ for(int i(0); i != n_steps; ++i)
{ s*= 1. + g()*std::sqrt(years_to_maturity/n_steps)
+ risk_free_rate* years_to_maturity/n_steps ; }
return s;

0 comments on commit ff6085a

Please sign in to comment.
Something went wrong with that request. Please try again.