Bug: date.cpp
Posted by Gilbert Peffer on Dec 21, 2000; 11:39am
URL: http://quantlib.414.s1.nabble.com/Bug-date-cpp-tp1643.html
I found a slightly more serious bug in Date::year(), unless it was an
intended behaviour.
I think the function only works correctly (explained below what that means),
if you calculate the year using
Year y = (theSerialNumber - 1)/365.25
The function, from my point of view, should at least implement the
year-change correctly. A little example using the 31/12/1999 and 1/1/2000
shows that the current function doesn't and the proposed one does:
31/12/1999 resulting in 2000.0657... (current)
resulting in 1999.9972... (new)
1/1/2000 resulting in 2000.0712... (current)
resulting in 2000 (new)
The integer part of the current version indicates that you are in the year
2000, although you are actually still in 1999. The proposed function
switches correctly.
Gilbert