From bug-request at octave dot org Sat Jan 7 20:37:05 2006 Subject: Re: etime in the new year From: Keith Goodman To: stefan at sun dot ac dot za, bug@octave.org Date: Sat, 7 Jan 2006 18:01:12 -0600 On 1/7/06, Stefan van der Walt wrote: > I saw formulas to calculate this thing in popular science magazines > before (Scientific American?). I'm sure there must be a relatively > simple way to accomplish this? I can' t find it in Popular American (Scientific Science?). The first hit I found was from Microsoft (which is popular but not scientific and by recently censoring a Chinese blogger is...): "To determine if a year is a leap year, follow these steps: 1. If the year is evenly divisible by 4, go to step 2. Otherwise, go to step 5. 2. If the year is evenly divisible by 100, go to step 3. Otherwise, go to step 4. 3. If the year is evenly divisible by 400, go to step 4. Otherwise, go to step 5. 4. The year is a leap year (it has 366 days). 5. The year is not a leap year (it has 365 days)." The 1278th hit was from Octave: >> help is_leap_year is_leap_year is the user-defined function from the file /usr/local/share/octave/2.9.3/m/miscellaneous/is_leap_year.m -- Function File: is_leap_year (YEAR) Return 1 if the given year is a leap year and 0 otherwise. If no arguments are provided, `is_leap_year' will use the current year. For example, is_leap_year (2000) => 1 which uses the code retval = ((rem (year, 4) == 0 & rem (year, 100) != 0) ... | rem (year, 400) == 0); ------------------------------------------------------------- Octave is freely available under the terms of the GNU GPL. Octave's home on the web: http://www.octave.org How to fund new projects: http://www.octave.org/funding.html Subscription information: http://www.octave.org/archive.html -------------------------------------------------------------