Bug 105174 - IsLeapYear function gives erratic results.
Summary: IsLeapYear function gives erratic results.
Status: RESOLVED NOTABUG
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
4.4.3.2 release
Hardware: x86-64 (AMD64) Linux (All)
: medium minor
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Calc-Function
  Show dependency treegraph
 
Reported: 2017-01-07 14:48 UTC by Louie
Modified: 2021-09-23 19:17 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
Known correct determinations of leap years vs isleapyear() function (239.20 KB, application/pdf)
2017-01-11 03:09 UTC, Louie
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Louie 2017-01-07 14:48:54 UTC
Testing confirms many leap years return 0, "not leap"; some non-leap years return 1, "are leap", some return correct results. Same results in version 5.1.4.2 build ID 1:5.1.4-0ubunto1 and version 4.4.3.2 Build ID: 40m0(Build:2)

Range years tested 0 - 3000.
Comment 1 Regina Henschel 2017-01-07 15:33:31 UTC
Please be more specific, which cases give a wrong result and why you think, that the result is wrong.
Comment 2 Louie 2017-01-11 03:09:39 UTC
Created attachment 130310 [details]
Known correct determinations of leap years vs isleapyear() function

Sequence of 3001 years tested in 4 known correct methods of determining leap year are used as arguments to isleapyear() function resulting in many false positives and many missed leap years.
Comment 3 GerardF 2017-01-11 10:35:31 UTC
A calc sheet would had been more usefull than a pdf.
We can't see how you are trying to use this function.

ISLEAPYEAR need a true date as argument, see the help for a correct use of the function :
https://help.libreoffice.org/Calc/Add-in_Functions#ISLEAPYEAR
Comment 4 Louie 2017-01-13 02:18:02 UTC
What is needed?
Comment 5 Xisco Faulí 2017-01-13 12:03:58 UTC
(In reply to Louie from comment #4)
> What is needed?

As said in comment 3, could you please attach a calc sheet ?
Comment 6 QA Administrators 2018-01-29 10:27:57 UTC Comment hidden (obsolete)
Comment 7 QA Administrators 2018-03-02 10:06:20 UTC Comment hidden (obsolete)
Comment 8 Mike Kaganski 2021-09-23 19:14:52 UTC
This was indeed NOTABUG. As GerardF mentioned in comment 3, ISLEAPYEAR expects a *date* as its argument, while Louie used calculation like '=ISLEAPYEAR(2021)' to learn is 2021 was a leap year. The correct calculation would be e.g. '=ISLEAPYEAR("2021-01-01")'.