![]() | |
![]() |
| | Thread Tools | Display Modes |
#11
| |||
| |||
|
|
Mark Brown wrote: Mark... do you have something to add? =`:^ I'm hoping you agree with me on this; seems nobody else does. -- frosty godric (AT) trapezesoftware (DOT) com> wrote in message news:1128678267.914647.31120 (AT) o13g2000cwo (DOT) googlegroups.com... frosty wrote: I wonder if the Pick (or at least UniData) ICONV function correctly calculates leap years in antiquity. Running the following program on UniData 6.0 gives an interesting result. FOR Y = 1 TO 12000 LY1 = (ICONV('3-1-':Y,'D') - ICONV('2-28-':Y,'D')) - 1 LY2 = (REM(Y,4)=0) AND ((REM(Y,100)#0) OR (REM(Y,400)=0)) IF LY1 # LY2 THEN CRT Y:' ':LY1:' ':LY2 NEXT Y The result is interesting in that it is not null; it indicates that UniData thinks the years 200 and 600 are leap years, but thinks that neither 400 nor 800 are leap years. 200 1 0 400 0 1 600 1 0 800 0 1 Comments? -- frosty The rules for determining leap years are actually - Once every 4 years Except every 100 years Except every 400 years So UNIDATA have it right.. We used to use it as a 'how many lines of code do you need to determine a leap year' in Databasic ( 1 as it happens ) Regards Godric |
#12
| |||
| |||
|
|
D3 works like: leapyear = (int(year/400) = year/400) or ((int(year/100) # year/100) and (int(year/4) = year/4)) because there's 365.24 days in a year, you add 1 every 4 years, adjust back once every 100 and ajust once again every 400. 400 and 800 should be leap years, and 200 and 600 should not be. IMO Mark "frosty" <frostyj (AT) bogus (DOT) tld> wrote in message news:5-ydnaexm8W3ktreRVn-uw (AT) adelphia (DOT) com... Mark Brown wrote: Mark... do you have something to add? =`:^ I'm hoping you agree with me on this; seems nobody else does. -- frosty godric (AT) trapezesoftware (DOT) com> wrote in message news:1128678267.914647.31120 (AT) o13g2000cwo (DOT) googlegroups.com... frosty wrote: I wonder if the Pick (or at least UniData) ICONV function correctly calculates leap years in antiquity. Running the following program on UniData 6.0 gives an interesting result. FOR Y = 1 TO 12000 LY1 = (ICONV('3-1-':Y,'D') - ICONV('2-28-':Y,'D')) - 1 LY2 = (REM(Y,4)=0) AND ((REM(Y,100)#0) OR (REM(Y,400)=0)) IF LY1 # LY2 THEN CRT Y:' ':LY1:' ':LY2 NEXT Y The result is interesting in that it is not null; it indicates that UniData thinks the years 200 and 600 are leap years, but thinks that neither 400 nor 800 are leap years. 200 1 0 400 0 1 600 1 0 800 0 1 Comments? -- frosty The rules for determining leap years are actually - Once every 4 years Except every 100 years Except every 400 years So UNIDATA have it right.. We used to use it as a 'how many lines of code do you need to determine a leap year' in Databasic ( 1 as it happens ) Regards Godric |
#13
| |||
| |||
|
|
Interesting sidethought, I always prefer writing: mod(year,400)=0 in preference to int(year/400)=year/400... it just seems more compact. Similarly mod(year,100)>0 instead of int(year/100) # year/100. So your statement becomes leapyear=((mod(year,400)=0) or ((mod(year/100)>0) and (mod(year,4)=0)) Guess I'm just bored on a Saturday morning. Regards Simon |
#14
| |||
| |||
|
#15
| |||
| |||
|
|
D3 works like: leapyear = (int(year/400) = year/400) or ((int(year/100) # year/100) and (int(year/4) = year/4)) because there's 365.24 days in a year, you add 1 every 4 years, adjust back once every 100 and ajust once again every 400. 400 and 800 should be leap years, and 200 and 600 should not be. IMO Mark "frosty" <frostyj (AT) bogus (DOT) tld> wrote in message news:5-ydnaexm8W3ktreRVn-uw (AT) adelphia (DOT) com... Mark Brown wrote: Mark... do you have something to add? =`:^ I'm hoping you agree with me on this; seems nobody else does. -- frosty godric (AT) trapezesoftware (DOT) com> wrote in message news:1128678267.914647.31120 (AT) o13g2000cwo (DOT) googlegroups.com... frosty wrote: I wonder if the Pick (or at least UniData) ICONV function correctly calculates leap years in antiquity. Running the following program on UniData 6.0 gives an interesting result. FOR Y = 1 TO 12000 LY1 = (ICONV('3-1-':Y,'D') - ICONV('2-28-':Y,'D')) - 1 LY2 = (REM(Y,4)=0) AND ((REM(Y,100)#0) OR (REM(Y,400)=0)) IF LY1 # LY2 THEN CRT Y:' ':LY1:' ':LY2 NEXT Y The result is interesting in that it is not null; it indicates that UniData thinks the years 200 and 600 are leap years, but thinks that neither 400 nor 800 are leap years. 200 1 0 400 0 1 600 1 0 800 0 1 Comments? -- frosty The rules for determining leap years are actually - Once every 4 years Except every 100 years Except every 400 years So UNIDATA have it right.. We used to use it as a 'how many lines of code do you need to determine a leap year' in Databasic ( 1 as it happens ) Regards Godric |
#16
| |||
| |||
|
![]() |
| Thread Tools | |
| Display Modes | |
| |