Login  Register

Re: a bug in Bonds.cpp

Posted by Luigi Ballabio on Feb 13, 2012; 5:22pm
URL: http://quantlib.414.s1.nabble.com/a-bug-in-Bonds-cpp-tp8727p8728.html

Yes, it's a bug.  I've fixed it on the 1.2 branch now.

Thanks for the heads-up.

Luigi


On Mon, Feb 13, 2012 at 3:15 PM, Dagur Gunnarsson <[hidden email]> wrote:

> hello,
>
> Is it ok, to post bugs in this mailgroup?  I suspect that there is a bug in
> the following code.
>
> 00247
> Real Bond::accruedAmount(Date settlement) const {
>   Real currentNotional = notional(settlementDate());
>   if (currentNotional == 0.0)
>    return 0.0;
>
>   return BondFunctions::accruedAmount(*this, settlement);
> }
>
> the code is taken from
>  http://quantlib.sourcearchive.com/documentation/1.1-1/bond_8cpp_source.html
>
> notional(settlementDate()) should be notional(settlement) instead - my unit
> tests stopped working for a bond that had a maturity the 8th of February.
>
> regards
> Dagur G
>
> ------------------------------------------------------------------------------
> Try before you buy = See our experts in action!
> The most comprehensive online learning library for Microsoft developers
> is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
> Metro Style Apps, more. Free future releases when you subscribe now!
> http://p.sf.net/sfu/learndevnow-dev2
> _______________________________________________
> QuantLib-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/quantlib-users
>

------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users