Talk:Leap year: Difference between revisions

m
no edit summary
("in the Gregorian calendar")
 
mNo edit summary
Line 2:
 
During 2011 August 13, Markjreed [http://rosettacode.org/mw/index.php?title=Leap_year&diff=117353&oldid=117345 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. --[[User:Kernigh|Kernigh]] 18:52, 6 October 2011 (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 !
[[User:Nochnix|Nochnix]] 11:06, 13 February 2012 (UTC)
Anonymous user