ExoticEngine, Chap. 7

This forum is to discuss the book "C++ design patterns and derivatives pricing."

ExoticEngine, Chap. 7

Postby lmgb » Thu May 13, 2010 7:22 am

Hello

1. In the ExoticEngine::DoSimulation method definition (p. 110), why do we resize TheseCashFlows again? The constructor will have already resized TheseCashFlows to the correct size when building the engine for the 1st time. I don't see why we need to do it again here.

2. In the ExoticEngine.cpp and ExoticBSEngine.cpp, there is no explicit "using namespace std;" command. However, math functions like exp, log and sqrt are used without any scope qualifier std::. The code compiles, but I don't understand why. How does the compiler know that exp, log and sqrt in these files are the ones defined in cmath? I guess it's picking up a "using namespace std;" somewhere... Or am I making some stupid confusion?

Thanks
lmgb
lmgb
 
Posts: 8
Joined: Thu Apr 15, 2010 12:02 am

Re: ExoticEngine, Chap. 7

Postby mj » Thu May 13, 2010 10:34 am

It's a curious fact that whilst it seems that you should need using std:: for cmath, in practice it seems that you don't.

I've never tracked down why.
mj
Site Admin
 
Posts: 1380
Joined: Fri Jul 27, 2007 7:21 am

Re: ExoticEngine, Chap. 7

Postby mj » Thu May 13, 2010 10:37 am

clearly, the second resize is superfluous.
mj
Site Admin
 
Posts: 1380
Joined: Fri Jul 27, 2007 7:21 am

Re: ExoticEngine, Chap. 7

Postby pzling » Mon Feb 27, 2012 4:25 am

Hi

In ExoticBSEngine.cpp, GetOnePath(), is there a technical reason to have CurrentSpot updated in two steps (ie. adding the Drift term and then Volatility term) or is this just for clarity/ease of reading?

Thanks
pzling
 
Posts: 41
Joined: Sat Jan 14, 2012 8:52 pm

Re: ExoticEngine, Chap. 7

Postby mj » Tue Feb 28, 2012 12:24 am

there was no particular reason.
mj
Site Admin
 
Posts: 1380
Joined: Fri Jul 27, 2007 7:21 am


Return to C++ design patterns and derivatives pricing

Who is online

Users browsing this forum: No registered users and 1 guest