[REVIEWED 3-5-1][PATCH] Fix leap year calculation

Kevin André hyperquantum at gmail.com
Wed Feb 29 06:38:30 PST 2012


On Wed, Feb 29, 2012 at 14:56, Lionel Elie Mamane <lionel at mamane.lu> wrote:
> On Tue, Feb 28, 2012 at 10:10:10PM -0500, Kohei Yoshida wrote:
>
>> From 0666b5dca1a210ce7abc61a522a59c48661fe664 Mon Sep 17 00:00:00 2001
>> From: Kohei Yoshida <kohei.yoshida at suse.com>
>> Date: Tue, 28 Feb 2012 22:01:52 -0500
>> Subject: [PATCH] Correctly calculate leap year.

>>      return ((nYear % 4) == 0)
>> -        && !(((nYear % 100) == 0) || ((nYear % 400) == 0));
>> +        && (((nYear % 100) != 0) || ((nYear % 400) == 0));

Why still that many parentheses? Couldn't it be simply:

return (nYear % 400) == 0 || ((nYear % 4) == 0 && (nYear % 100) != 0);

?
In case I'm missing something here, forgive me my ignorance. I'm just
an outsider :-)


Regards,

Kevin André


More information about the LibreOffice mailing list