Fwd: baroneadesiwhaley.cpp bug

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Fwd: baroneadesiwhaley.cpp bug

feynman44
Hello ...?

Note: forwarded message attached.



               
__________________________________
Start your day with Yahoo! - Make it your home page!
http://www.yahoo.com/r/hs
There are a couple of bugs in baroneadesiwhaley.cpp:

The Option::Call case, before the while loop there's
the line:

        bi =  dividendDiscount * cumNormalDist(d1) * (1 -
1/Q) +
                (1 - dividendDiscount *
                cumNormalDist(d1) / QL_SQRT(variance)) / Q;

I believe this should read:

        bi =  dividendDiscount * cumNormalDist(d1) * (1 -
1/Q) +
                 (1 - dividendDiscount *
                cumNormalDist.derivative(d1) / QL_SQRT(variance)) /
Q;

And on the put side, the same bug is inside the while
loop:

        bi = -dividendDiscount * cumNormalDist(-d1) *
                (1 - 1 / Q)
                - (1 + dividendDiscount * cumNormalDist(-d1)
                / QL_SQRT(variance)) / Q;

I believe it should be:

        bi = -dividendDiscount * cumNormalDist(-d1) *
                (1 - 1 / Q)
                - (1 + dividendDiscount *
cumNormalDist.derivative(-d1)
                / QL_SQRT(variance)) / Q;

Incidentally the same bug exists in the Haug book VBA
code...



               
__________________________________
Start your day with Yahoo! - Make it your home page!
http://www.yahoo.com/r/hs
Reply | Threaded
Open this post in threaded view
|

Re: Fwd: baroneadesiwhaley.cpp bug

Luigi Ballabio
On 11/02/2005 05:38:23 PM, feynman44 wrote:
> Hello ...?

Cheers,
        checking your patch is in my todo list, but more mundane tasks  
like my real job tend to get in the way :)
I'll get bask to you as soon as possible.

Later,
        Luigi

----------------------------------------

standards, n.:
         The principles we use to reject other people's code.