Login  Register

RE: Latest commits

Posted by Luigi Ballabio-2 on Jul 23, 2003; 5:35am
URL: http://quantlib.414.s1.nabble.com/Latest-commits-tp10269p10277.html

At 12:37 PM 7/23/03 +0200, Jens Thiel wrote:

>one idea here: implement < and > for the cases were it is well defined, and
>expand == to be "not larger and not smaller", eg.
>
>   4w<1m false
>   4w>1m false
>
>   4w==1m expands to ( !(4w<1m) && !(4w>1m) ) which is true
>
>   28d<1m        false
>   31d>1m        false
>
>   30d==1m expands to ( !(30d<1m) && !(30d>1m) ) which is true

Hmm, I still have the problem that:

Date d(23,7,2003);
Period p1(30,Days);
Period p2(4,Weeks);
Period p3(1,Months);

p1 == p3                 => true
d.plus(p1) == d.plus(p3) => false
p2 == p3                 => true
d.plus(p2) == d.plus(p3) => false

which is kind of surprising, and the additional problem that equality is
not transitive:

30d == 1m  => true
1m == 4w   => true
30d == 4w  => false

Later,
         Luigi