Overview
The JMB_CALND is a 4k Module comprising a selection of Calendar-related
programs using the routines available on Jean-Marc Baillard’s
web pages. Like it occurs with any selection, it is necessarily incomplete but
we think it is representative of the material posted on-line. A few additional
MCODE functions are also included in the module to improve the algorithms and reduce
the execution times.
The table below shows the function
names and brief descriptions. Click on the URLs for a direct access to the web
pages for each program.
XROM |
Function |
Desciption |
URLs |
17,00 |
-JMB_CALND
|
Section Header |
///////////////////////////////// (**) Cyclical Calendars Cyclical Calendars Cyclical Calendars Hindu Calendars Illuminated Moon (**) Jul & Greg Calendars (see below) (see below) Hindu Calendars Hindu Calendars Other Calendars Jewish Pessah Phases of the Moon Cyclical Calendars Years & Months (**) |
(*): "J0" & "DT" use Gregorian dates after
1582/10/15 and Julian dates before 1582/10/04
(**): Driver programs
simply guide you through the data entry required for the main routines to
perform its calculations. They are easily recognized by the “+” sign in the
program name.
If you’re interested in these subjects you’re also encouraged to see the
companion “User_Calendar” module, with a collection
of User-Library programs and a set of calendar functions implemented using the
TIME Module.
JDAY and CDAY are mutually reciprocal date functions to
convert a given calendar date into the Julian day number and back to the
calendar date. Use flag 00 to select
either Julian or Gregorian calendars in the
conversions. The
date format is also MM.DDYYYY regardless of the time module settings if theres one.
STACK |
INPUT/OUTPUT |
OUTPUT/INPUT |
X |
MN.DDYYYY |
Julian Day Nb |
Example: the date May 21st, 2014 corresponds to 2,456,799
(Gregorian calendar) or 2,456,812 (Julian calendar) day numbers.
You can also use JDAY to calculate the elapsed number of days between two dates simply
converting both to their Julian day numbers and subtracting them. These two
functions are based on the PPC routines JC and CJ ported to an all-MCODE
implementation to make it faster.
The formulas used are as follows (see PPC ROM manual for details):
Let:
x = Y + (M-2.85) / 12
JDN = int{ int [ [ D + int(367 x) - int(x) ] - 0.75 * int(x) ] - 0.75 * int[int(x)/100) } + 1,721,115;
Let
N = JDN - 1,721,119
C = int {(N-0.2(/36,524.25]
if Gregorian: N '
= N + C - int(C) – or
if Julian: N' = N + 2
Y' = int[(N' -0.2) / 365.25];
N" = N' - int(365.25 * Y']
M' = int[(N"
- 0.5) / 30.6]; D = int [N" -
30.6 * M' + 0.5].
Date
<-> Number of Days since 2000/01/01
The routine "J0" computes the number of days
since 2000/01/01 0h ( i-e
the Julian Day number minus 2451544.5 ) in X-register and the day of the week
in T-register. Registers Y and Z are preserved.
The Gregorian calendar
reform is taken into account: The day following 1582/10/04 is 1582/10/15
Note that "J0" (and "DT"
= the reverse operation) are valid at least since 4713 B.C. up to ... the next
calendar reform!
STACK |
INPUTS |
OUTPUTS |
T |
/ |
dow |
Z |
Z |
Z |
Y |
Y |
Y |
X |
YYYY.MNDDdd |
N |
L |
/ |
YYYY.MNDDdd |
(dow = day of week = 0 for Sunday, 1 for Monday, ... ,
6 for Saturday )
-N= the number of days
between a date YYYY.MMDDdd and 2000/01/01 at 0h = the Julian Day number minus 2451544.5
Examples:
April 4th 2134 at 6h
AM 2134.040425 XEQ
"J0" >>> N = 49036.25
RDN RDN dow = 0 = Sunday
1234.0428
XEQ "J0"
>>> N = -279651 RDN
RDN dow = 5 = Friday
-4123.0707 XEQ "J0" >>> N =
-2236225 RDN RDN dow = 1 = Monday
-"DT" performs the reverse transformation
STACK |
INPUTS |
OUTPUTS |
Z |
Z |
Z |
Y |
Y |
Y |
X |
N |
YYYY.MNDDdd |
L |
/ |
N |
Examples:
N = 49036.25 XEQ "DT" >>> 2134.040425
N = -279651 XEQ "DT" >>> 1234.0428
N = -2236225 XEQ "DT" >>> -4123.0707
Notes:
J2K is an M-Code routine that requires the HP-41CX (the TIME module will not do!). It takes
a Gregorian date (even before 1582) YYYY.MMDD and returns the number of days
since 2000/01/01
“DTTM”
is similar to ‘DT but it requires the TIME Module (or the CX( to work. It takes the
number of days since 2000/01/01 and returns the Gregorian date YYYY.MMDD
Example
of a Luni-Solar Calendar
"GR-LS" & "LS-GR" perform the conversion
between Gregorian dates and a hypothetic Luni-Solar
calendar that employs the following approximations:
1 Lunar month
= 334995 / 11344 days ~ 29.53058886 days
1 tropical year / 1 lunar month = 774439 / 62615 ~ 12.36826639
which leads to 1 tropical year ~
365.2421896 days
STACK |
INPUT1 |
OUTPUT1 |
INPUT2 |
OUTPUT2 |
X |
YYYY.MNDDGr |
yyyy.mnddLS |
yyyy.mnddLS |
YYYY.MNDDGr |
Examples:
-3101.0123
XEQ "GR-LS"
>>>> 0.0101
XEQ "LS-GR" ( or simply R/S ) >>>>
-3101.0123
1979.0716 XEQ "GR-LS"
>>>> 5080.0721 XEQ
"LS-GR" ( or simply R/S )
>>>> 1979.0716
2012.1221 XEQ "GR-LS"
>>>> 5113.1308 XEQ
"LS-GR" ( or simply R/S )
>>>> 2012.1221
2015.1014 XEQ "GR-LS"
>>>> 5116.1001 XEQ
"LS-GR" ( or simply R/S ) >>>>
2015.1014
Notes:
- Here, the years yyyy may also be negative (otherwise, delete lines
48-40-39-38).
- These programs take the onset of the Kali-Yuga as origin i-e -3101.0123 (Gregorian Calendar) -3101 =
3102 B.C.
- In calendrical
calculations, we often have to compute floor(y.z/x)
or ceil(y.z/x) where x , y , z are
integers
- We can take advantage of the 13-digit routines to use these formulas even
if y.z > E10 provided y.z/x remains < E10
- The MCODE functions FMD & CMD perform these calculations.