operator < in Period class incorrect (sometimes)

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

operator < in Period class incorrect (sometimes)

Chris Kenyon-2
Dear All,

doing a comparison between Period(3, Months) and Period(1, Weeks) fails with "undecidable comparison" when < is used.  It obviously shouldn't.  I've opened a bug tracker item and uploaded a suggested fix.

Best,

[hidden email]

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

// Demonstrates false undecidability in Period operator < using QuantLib-0.8.1.
#include <iostream>
#include <ql/quantlib.hpp>
using namespace std;
using namespace QuantLib;

int main (int argc, char * const argv[]) {
Period p3m(3, Months), p1w(1, Weeks);

cout<<"Hello, World! " << p3m << ", " << p1w << endl;

bool bigGTsmall = p3m > p1w;
cout << "bigGTsmall = " << bigGTsmall << endl;

// next comparison throws "undecidable comparison"
bool bigLTsmall = p3m < p1w;
cout << "bigLTsmall = " << bigLTsmall << endl;

return 0;
}

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: operator < in Period class incorrect (sometimes)

Luigi Ballabio

On Tue, 2007-11-06 at 08:01 -0800, Chris Kenyon wrote:
> doing a comparison between Period(3, Months) and Period(1, Weeks)
> fails with "undecidable comparison" when < is used.  It obviously
> shouldn't.  I've opened a bug tracker item and uploaded a suggested
> fix.

Hi Chris,
        I've fixed it---thanks for the patch.

Luigi


--

Newton's Law of Gravitation:
What goes up must come down. But don't expect it to come down
where you can find it. Murphy's Law applies to Newton's.



-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

FixedRateBond constructor...

Toyin Akin
 
Hi,
 
Within one of the FixedRateBond constructors you have the following code...

Date firstDate = (endOfMonth ? Date() : stubDate);
Date nextToLastDate = (endOfMonth ? stubDate : Date());
 
Shouldn't this be :
 
Date firstDate = (backward ? Date() : stubDate);
Date nextToLastDate = (backward ? stubDate : Date());
 
Toy out...
 


The next generation of MSN Hotmail has arrived - Windows Live Hotmail
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Bond - US Treasury Yields...

Toyin Akin
In reply to this post by Luigi Ballabio

Hi,
 
Can anybody confirm whether computing yields via the bond class where one specifies "SimpleThencompounded" as the Compounding type correctly reproduces the equivalent US Treasury yield value (assuming the correct DayCounters and schedules are produced).
 
Thanks in advance,
Toy out...



Are you the Quizmaster? Play BrainBattle with a friend now!
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: FixedRateBond constructor...

Luigi Ballabio
In reply to this post by Toyin Akin

On Thu, 2007-11-08 at 04:22 +0000, Toyin Akin wrote:

> Within one of the FixedRateBond constructors you have the following
> code...
>
> Date firstDate = (endOfMonth ? Date() : stubDate);
> Date nextToLastDate = (endOfMonth ? stubDate : Date());
>  
> Shouldn't this be :
>  
> Date firstDate = (backward ? Date() : stubDate);
> Date nextToLastDate = (backward ? stubDate : Date());

Yes, you're right. It's fixed now. Thanks for the heads-up.

Luigi


--

Vin: It's like this fellow I knew in El Paso. One day, he just took
all his clothes off and jumped in a mess of cactus. I asked him that
same question, "Why?"
Calvera: And?
Vin: He said, "It seemed like a good idea at the time."
-- The Magnificent Seven



-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users