Code review. (D Munro problem 2.12)

My two cents to keep straying away from the original post.

New year in Britain was on March 25th, for a while.

@BB_UK also notice that leap year are those which are mod 4 == 0, but those which are mod 400 != 0 are not leap years. 1900 and 2100 are not leap years. I think this is one of the main points of Gregorian Calendar.

“New year in Britain was on March 25th, for a while.” Their tax year now begins on April 6 because of their calendar change. Related topics: Microsoft Excel falsely pretends 1900 was a leap year. . And I hate times like 12:00 am or pm. We have perfectly good words “noon” and “midnight” so why not use them?

Did you notice the function in the above code:

   logical function is_leap_year( year )
      integer, intent(in) :: year
      is_leap_year =  (modulo(year,400)==0) .or. ((modulo(year,4)==0) .and. (modulo(year,100).ne.0))
      return
   end function is_leap_year

Since this expression only tests against 0, it works just as well using mod() as modulo().

No, I haven’t noticed. My fault. Thanks

If you are working on a day-of-week function or subroutine, or are about to adopt a new one, here is something that may interest you:
Next year, 2026, there are three months in which Friday the 13th exists. The sum of the month numbers is 16 (if someone says “sixteen”, I am tempted to say, “bless you”), and the doomsday of 2026 is “Saturday”. In some cultures, Saturn is associated with a localized version of Satan.
From, the Web, I note:
"2015 was the last time this happened - it occurs in 1/7 of years, but not evenly spaced. (any common year where 1/1 is Thursday or leap year where 1/1 is Sunday; 2009 and 2012 both had it, but 2037 is the next occurrence after 2026.
It would seem that three Friday-13ths in a year is a more rare occurrence than eclipses! Here is a list of such years from 1900 onwards:

1903,
1914,
1925,1928,
1931,
1942
1953,1956,1959
1970
1981,1984,1987,
1998,
2009,2012,2015,
2026,
2037,
2040,2043

1 Like