|
From: Peter C. <pca...@gm...> - 2015-03-22 08:54:25
|
Hi Alex,
I am in favour of this. Just note that (at least) you would have to
take care about Date::yearOffset(...) and Date::maxSerialNumber(...)
as well when extending the range of possible dates. I am not sure if
there are other code places to consider, Luigi will be the right
person to answer that ultimately.
Apart from that I played around a bit and
boost::gregorian::gregorian_calendar::is_leap_year(y)
seems to be faster than the original ql code anyway (only 1900 is
treated different, ql is following the excel "convention" here). I
seem to observe a factor ql / boost of around 6.
And this
inline bool isLeap2(int y) {
if(y%4 != 0) return false;
if(y%100 != 0) return true;
if(y%400 != 0) return false;
return true;
}
is even faster (ql / isLeap2 = 40 ). Again be careful with 1900.
Best regards
Peter
On 22 March 2015 at 03:02, Alexander Lamana <am...@vi...> wrote:
> Hi,
>
> I was looking at date.cpp and noticed this [0]. I realize that 2200 is far
> off, but this section made me wince.
>
> Is there any interest in (or reason against) redoing this section so that it
> lazily populates an array, instead of having one hard coded? I have some
> spare time this weekend.
>
> [0]
> https://github.com/lballabio/quantlib/blob/master/QuantLib/ql/time/date.cpp#L208
>
>
> Thanks,
> Alex
>
> ------------------------------------------------------------------------------
> Dive into the World of Parallel Programming The Go Parallel Website,
> sponsored
> by Intel and developed in partnership with Slashdot Media, is your hub for
> all
> things parallel software development, from weekly thought leadership blogs
> to
> news, videos, case studies, tutorials and more. Take a look and join the
> conversation now. http://goparallel.sourceforge.net/
> _______________________________________________
> QuantLib-dev mailing list
> Qua...@li...
> https://lists.sourceforge.net/lists/listinfo/quantlib-dev
>
|