Talk:Leap year: Difference between revisions

From Rosetta Code
Content added Content deleted
(→‎REXX Version 4: new section)
Line 10: Line 10:
And probably any compiler will optimize better this code. Okay, it's probably not *that* important to optimize Is_Leap_Year !
And probably any compiler will optimize better this code. Okay, it's probably not *that* important to optimize Is_Leap_Year !
[[User:Nochnix|Nochnix]] 11:06, 13 February 2012 (UTC)
[[User:Nochnix|Nochnix]] 11:06, 13 February 2012 (UTC)

== REXX Version 4 ==


<br><br>If a year below 100 is to be used, the year should have leading zeroes added (to make it four digits).
<br>
<br> '''I think this sentence and the claim below is wrong- Program should only support yy and yyyy'''
--Walter Pachl 08:17, 17 April 2021 (UTC)
leapyear: procedure; parse arg y /*year could be: Y, YY, YYY, YYYY*/

Revision as of 08:17, 17 April 2021

"in the Gregorian calendar"

During 2011 August 13, Markjreed amended the task to specify "in the Gregorian calendar". This contradicted the Ruby example, which already used the Julian calendar for years before 1583. I have now added an alternate Ruby example that uses proleptic Gregorian calendar. --Kernigh 18:52, 6 October 2011 (UTC)

There used to be a lengthy discussion here about the leap year rules in effect that led to that change. What happened to the history of the talk page? --Markjreed 19:11, 12 March 2012 (UTC)

Faster implementation

After some experiments with gcc, I suggest to write, instead of the usual version :

  (Year mod 4 = 0) and ((Year mod 100 <> 0) or (Year mod 16 = 0))

That way there is only one division to do. Even though gcc uses imul to do that, it's still shorter. And probably any compiler will optimize better this code. Okay, it's probably not *that* important to optimize Is_Leap_Year ! Nochnix 11:06, 13 February 2012 (UTC)

REXX Version 4



If a year below 100 is to be used, the year should have leading zeroes added (to make it four digits).

I think this sentence and the claim below is wrong- Program should only support yy and yyyy --Walter Pachl 08:17, 17 April 2021 (UTC) leapyear: procedure; parse arg y /*year could be: Y, YY, YYY, YYYY*/