| Leap Year | |
| History Of The Leap Year | |
|
The calculation of leap years is one of the more divisive and misunderstood issues in computer science. Before jumping into the subject, let's take a brief look at why leap years exist at all. The strict definition of a year is "the interval between two successive passages of the Sun through the vernal equinox." The vernal equinox is the exact moment when the Sun is above the equator moving south to north. This definition of a year is known as the "tropical year" and is 365.24219 days in length (365 days, 5 hours, 48 minutes, and 46 seconds). With the introduction of the Julian calendar in 46 BC, the number of days in a year was rounded up to 365.25. With the Julian calendar, a simple leap year rule was used: if the year was evenly divisible by four, it was a leap year. Unfortunately, the difference between a tropical year (365.24219 days) and the Julian year (365.25 days) introduced errors that over time added up. This error resulted in a year that was 11 minutes and 14 seconds too long, which adds up to a whole day every 128 years. By the 1500's, this error added up to approximately 10 days. This problem was addressed in the Gregorian calendar instituted in 1582 by Pope Gregory XIII. The fix was to make the determination of leap years a bit more accurate. In the Gregorian calendar, a year is defined as being 365.2425 days in length. This is not exactly equal to a tropical year, but is so close that the error amounts only to about 3 days in 10,000 years. Since we now use the Gregorian calendar, we use the rule made official by papal decree: "Every fourth year is a leap year except for century years that are not evenly divisible by 400." What does this mean to you? Simply put, the Year 2000 is absolutely a leap year! |
|
| Determining Leap Years | |
|
So, if a leap year is every fourth year except for century years that are not evenly divisible by 400, the following algorithm correctly deduces leap years. Pseudocode for Determining Leap Years If MyYear Mod 4 = 0 Then ' Is it a century? If MyYear Mod 100 = 0 Then ' If a century, must be evenly divisible by 400. If MyYear Mod 400 = 0 Then LeapYear = True Else LeapYear = False End If Else LeapYear = True Endif Else LeapYear = False End If |
|
| Copyright 1999 Verstand Ltd, Some content was derived from an article on the Microsoft website. |