test-suite failure with capfloor on mac

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

test-suite failure with capfloor on mac

mrtreibe
As a small contribution I'm putting together a fink package description
for the mac.  Fink is basically a collection of unix-ports that uses
the debian package system.  Previously I was using quantlib without
cppunit but I eventually got around to installing it and found that the
test-suite is successful with the exception of a single case in the
cap/floor dependency on strike.  Here's the output from
quantlib-test-suite:

Test Results:
Run:  77   Failures: 1   Errors: 0


1) test: Testing cap/floor dependency on strike (F) line: 164
capfloor.cpp
  "NPV is increasing with the strike in a cap:
     length: 5 years
     volatility: 1.00 %
     value: -0.000000 at strike: 6.00 %
     value: 0.000000 at strike: 7.00 %"

By expanding the precision displayed it looks like its a numerical
rounding error thats probably an artifact of the double-precision
emulation of the G4.  Given below are other values at different strikes
for a length of 5 years and a volatility of 1%.

    values: 9.13001481746623966274 at strike: 3.00 %
    values: 4.70647037771517862126 at strike: 4.00 %
    values: 0.31883582613931149563 at strike: 5.00 %
    values: 0.00000081081387526048 at strike: 5.50 %
    values: -0.00000000000000001577 at strike: 6.00 %
    values: 0.00000000000000000000 at strike: 6.50 %
    values: 0.00000000000000000000 at strike: 7.00 %

The above results were from 0.3.4 but I also tested with cvs and had
the same results.  I'm tempted to just remove that single case for the
fink package but how can the implementation be corrected for the mac?  
Is it there another problem here that I'm overlooking.

Mark.



Reply | Threaded
Open this post in threaded view
|

Re: test-suite failure with capfloor on mac

Ferdinando M. Ametrano-3
Hi Mark

>As a small contribution I'm putting together a fink package description
>for the mac.
>Fink is basically a collection of unix-ports that uses the debian package
>system.
great!

>1) test: Testing cap/floor dependency on strike (F) line: 164 capfloor.cpp
>  "NPV is increasing with the strike in a cap:
>     length: 5 years
>     volatility: 1.00 %
>     value: -0.000000 at strike: 6.00 %
>     value: 0.000000 at strike: 7.00 %"
>
>By expanding the precision displayed it looks like its a numerical
>rounding error thats probably an artifact of the double-precision
>emulation of the G4.
I will investigate this.

>The above results were from 0.3.4 but I also tested with cvs and had the
>same results.
Can I suggest you to try the 0.3.5 release candidate:
http://www.quantlib.org/gm/
It should be released by the end of this month, and it would be nice to
have a fink package.
It would be even better if you check 0.3.5f0 out from the CVS with the tag
R000305f0: I will probably extend the test failure output and might need
your feedback.

>   I'm tempted to just remove that single case for the fink package but
> how can the implementation be corrected for the mac?
I would be quite unhappy with this non-solution :(

thank you for your time and contribution

ciao -- Nando



Reply | Threaded
Open this post in threaded view
|

Re: test-suite failure with capfloor on mac

mrtreibe
>>
> Can I suggest you to try the 0.3.5 release candidate:
> http://www.quantlib.org/gm/
> It should be released by the end of this month, and it would be nice
> to have a fink package.
> It would be even better if you check 0.3.5f0 out from the CVS with the
> tag R000305f0: I will probably extend the test failure output and
> might need your feedback.

I checked out the R000305f0-branch from cvs and compiled it with the
same results.  The test suite passes everything except for that single
case.

!!!FAILURES!!!
Test Results:
Run:  103   Failures: 1   Errors: 0


1) test: Testing cap/floor dependency on strike (F) line: 154
capfloor.cpp
  "NPV is increasing with the strike in a cap:
     length: 5 years
     volatility: 1.00 %
     value: -0.000000 at strike: 6.00 %
     value: 0.000000 at strike: 7.00 %"

I'm going to try to investigate it some more on the weekend and I'll be
glad to give you any feedback you need.

>
>>   I'm tempted to just remove that single case for the fink package
>> but how can the implementation be corrected for the mac?
> I would be quite unhappy with this non-solution :(

I meant that for the 0.3.4 package but I see in History.txt/News.txt
that your planning on the 0.3.5 release at the end of march.  Hopefully
we can get this resolved for that release.

Mark.



Reply | Threaded
Open this post in threaded view
|

Re: test-suite failure with capfloor on mac

Ferdinando M. Ametrano-3
Hi Mark

>I checked out the R000305f0-branch from cvs and compiled it with the same
>results.  The test suite passes everything except for that single case.

I've probably just patched the problem. It was related to numerical
rounding errors of the normal cumulative function N(x) for x around -7.5,
and I've fixed it requiring that is fabs(N(x))<1e-16 then the result is
zero. I've made this patch in the Black formula, while it probably should
go in the normal cumulative function.

The real solution would be to improve our normal cumulative function, but
I'm not an expert and for QuantLib I borrowed the best implementation I
know of (from "Monte Carlo Methods in Finance" by Peter Jaeckel). Of course
any contribution about this is welcome.

Mark, would you update you local copy of the branch R000305f0 and give me a
feedback about the patch?

thank you very much

ciao -- Nando




Reply | Threaded
Open this post in threaded view
|

Re: test-suite failure with capfloor on mac

mrtreibe
Hi Nando

Sorry about the late reply, for some reason I only received these
emails today.

>
> Mark, would you update you local copy of the branch R000305f0 and give
> me a feedback about the patch?
>

The patch worked!:
"
OK (103 tests)
"
I'll backport the patch as a diff for the 0.3.4 package for fink and
then I'll simply have to remove the diff when I update the package for
0.3.5.

Thanks for fixing it.

Mark.