Posted by
Xavier.Abulker on
Sep 23, 2002; 7:23am
URL: http://quantlib.414.s1.nabble.com/bugs-in-quantlib-in-bootstrap-and-CumulativeNormalDistribution-tp2182p2183.html
Hi Luigi,
thanks for your answer.
Unfortunately your guess:
a) remove the line
static const Math::CumulativeNormalDistribution f_;
from europeanoption.hpp
b) replace the line
const Math::CumulativeNormalDistribution EuropeanOption::f_;
in europeanoption.cpp with
namespace {
const Math::CumulativeNormalDistribution f_;
}
and leave the rest unmodified
gives me the same wrong pricing on Unix.
We finally found a way to fix this problem, I'm going to send another email
with our fix proposal.
Thanks
doesn't work and
Luigi Ballabio
<luigi.ballabio@fast To:
[hidden email],
webnet.it>
[hidden email]
cc:
18/09/2002 15:31 Subject: Re: [Quantlib-users] bugs in quantlib in bootstrap
and CumulativeNormalDistribution
Hi Xavier,
sorry for the delay, but we're having some hectic weeks and
QuantLib has to get behind...
At 07:21 PM 9/11/02 +0200,
[hidden email] wrote:
>Bug 1: already reported :
>
>"Crashing error in bootstrap:
>Building piecewiseFlatForward curve with futures and swaps only, the
>function crash.
>As far as I understand, This is because in FuturesRateHelper'
>discountGuess() function it calls discountImpl which try to get a value
>with array index -1.
>As a safety guard, I think in bootstrap() of PiecewiseFlatForward, we
>should have
> double guess= ( (i==1)? Null< double >() : instrument->discountGuess()
);
>instead of
>double guess = instrument->discountGuess();
>To prevent this from happening. "
I haven't been able to reproduce this (and besides, I've had a look at
discountImpl and it seems sound---i.e., steps are taken to ensure that
the array is not accessed out of bounds).
Can you send me a set of data for which the bootstrapping fails?
>Bug2: Europeanoption pricing on Unix:
>We check the code and found that in "europeanoption.hpp" the following
>const static member is declared:
>
> static const Math::CumulativeNormalDistribution f_;
>
>This variable "f_" is never explicitly initialized, thus it is up to the
>compilor to decide what to do when it is first used.
Argh. I'm tempted to blame the compiler for this, as the above is
initialized in europeanoption.cpp as
const Math::CumulativeNormalDistribution EuropeanOption::f_;
which should be equivalent to
const Math::CumulativeNormalDistribution EuropeanOption::f_ =
Math::CumulativeNormalDistribution();
which in turn should properly initialize f_ with a sigma=1.
However, I'm too lazy to look up the C++ standard, so I might be wrong.
Anyway, let's try to code around this. What happens on Unix if you:
a) remove the line
static const Math::CumulativeNormalDistribution f_;
from europeanoption.hpp
b) replace the line
const Math::CumulativeNormalDistribution EuropeanOption::f_;
in europeanoption.cpp with
namespace {
const Math::CumulativeNormalDistribution f_;
}
and leave the rest unmodified?
Later,
Luigi
*************************************************************************
Ce message et toutes les pieces jointes (ci-apres le "message") sont
confidentiels et etablis a l'intention exclusive de ses destinataires.
Toute utilisation ou diffusion non autorisee est interdite.
Tout message electronique est susceptible d'alteration.
La Fimat et ses filiales declinent toute responsabilite au
titre de ce message s'il a ete altere, deforme ou falsifie.
********
This message and any attachments (the "message") are confidential and
intended solely for the addressees.
Any unauthorised use or dissemination is prohibited.
E-mails are susceptible to alteration.
Neither Fimat nor any of its subsidiaries or affiliates shall
be liable for the message if altered, changed or falsified.
*************************************************************************