From bug-request at octave dot org Sat Jan 7 21:04:22 2006 Subject: Re: etime in the new year From: Bill Denney To: Keith Goodman cc: stefan at sun dot ac dot za, bug@octave.org, jwe@bevo.che.wisc.edu Date: Sat, 7 Jan 2006 22:03:11 -0500 (EST) There is also a function is_leap_year in regular octave that implements this. I actually was debating issuing a minor bug report on it that it's in the miscellaneous directory when it should be in the time directory. Bill On Sat, 7 Jan 2006, Keith Goodman wrote: > 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 > ------------------------------------------------------------- > -- "When I use a word," Humpty Dumpty said, in a rather scornful tone, "it means just what I choose it to mean -- neither more nor less." -- Lewis Carroll ------------------------------------------------------------- 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 -------------------------------------------------------------