Author: David WilliamsDavid Williams
Date: Dec 2, 2006 21:25
I've been trying to make a version of that Julian Day program that I
posted a while back that would be as generic and simple as possible, so
people who like to transfer things to other versions of BASIC can do
so. I think the following version is about the best I can do with it. I
put in line-numbers, replaced fancy loop structures with GOTOs, used a
GOSUB instead of subroutine modules, and so on. About the only things
that I can imagine might not port to other dialects easily are the
ON...GOTO, and a few string operations. For example, in QBasic,
STR$(123) is " 123". Note the initial space. So MID$(STR$(123),3) is
"23", i.e. the characters in the STR$ from the third onward.
The numeric variables can all be single-precision floating-point ones.
No double-precision floats or long integers are needed.
And the thing is short enough that the whole program, apart from a few
initial comments, can be fitted on a single screen.
Note the restrictions on the dates it can handle. Gregorian dates
before the year 1582 are meaningless, since the calendar started then.
And dates after 3500 can't be handled by the program because JD 3000000
falls in 3501, and after that the cheat that I used to squeeze the
numbers into single-precision floats doesn't work.
|