[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Leap year algorithm needed



Picky, picky...  ;-)  I am just glad I got the logic correct...

Steve Reeves wrote:

> In article <37137073.81146F30@ix.netcom.com>, Nick wrote:
> >if(!(year % 400) || (!(year % 4) && (year %100))) thisyear=leapyear;
>
> Its a little more efficient to do the division by 4 first:
>
> if (!(year % 4) && ((year % 100) || !(year % 400))) is_leap_year = TRUE;
>
> --
> Steve Reeves
> stever@gate.net