What does this line of code mean in non-code speak?
Afficher commentaires plus anciens
if (div4 & ~( xor(div100, div400)))
div4 div100 and div400 are given by:
div4 = ((year/4) == floor (year/4));
div100 = ((year/100) == floor (year/100));
div400 = ((year/400) == floor (year/400));
Réponse acceptée
Plus de réponses (2)
Roger Stafford
le 16 Juin 2013
In other words, this logical statement is true when 'year' is to be a leap year under the Gregorian calendar. They could just as well have written
if div4&(div100==div400)
or, given the definitions of these quantities,
if div4&(div100<=div400)
or, again given their definitions, even this
if div400|(div4~=div100)
Andrei Bobrov
le 16 Juin 2013
~rem(year,4)&rem(year,100)|~rem(year,400)
Catégories
En savoir plus sur Calendar dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!