Hi Winfried,
On Thursday, 2012-04-26 13:55:14 +0200, Winfried Donkers wrote:
I have added the formula 'datedif', as defined in ODF 1.2 to calc (see diff).
Hey, great!
2. the calculation in DateDif(..) uses mean values for days in year
(365.2425) and for days in month (30.4369). That will in some
instances lead to -seemingly?- incorrect results. Should I do
something about that, i.e make the code date-concious?
Yes please, make it leap year aware and use correct values for days in
months.
3. The various defined values for paramter fmt (d, m, y, yd, ym, md)
are 'hard' in the code ("d", "m", "y", "yd", "ym", "md"). This does
not look neat to me. is there a preferred way of doing such things?
No, hard coded is fine in this case as the values are not to be
translated. However, string comparison should be case insensitive to
allow also upper case values. IMHO Excel does that. Btw, do you have
access to an Excel version to compare?
5. ODF 1.2 defines DATEDIF, but the languages I've seen using this
function use DATEDIFF. Why is ODF different (or isn't it)?
The function originates from Lotus 1-2-3 where it was called DATEDIF,
MS-Excel called it the same, and ODF just adopted that name. The
DATEDIFF function you mention is something different (VBA?).
Now some nitpicks on your code ;)
+++ b/sc/source/core/tool/addinhelpid.cxx
Is there a specific reason why you implemented this in the
Analysis-AddIn? I don't recall exactly whether this function was
provided in Excel as an AddIn or built-in. If as AddIn it makes sense to
implement it in our AddIn for import/export from/to Excel, if not then
a built-in function may be easier.
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.