cbzero
Joined: 10 Jul 2022 Posts: 4 Location: United States
|
Posted: Wed Aug 03, 2022 3:42 am Post subject: Calculating the difference between two dates |
|
|
I've come up with an algorithm for calculating the difference (in days) between two dates. It assumes a 360-day calendar, so it is only useful for certain purposes. Still, I thought it might be interesting to some people here.
I only have a Curta type 2 to test it on, but I don't believe it will work on a type 1 due to the number of digits needed.
Let's say we want to calculate the difference between today (3 August 2022) and Christmas Day, 1990 (maybe it was the day I got my first calculator).
Start by putting decimal markers on the RR between positions 3-4, 5-6, and 7-8.
Enter the later date on the leftmost position (places 11 to 4) in SR in YYYYMMDD format. SR should look like 20220803000. With the carriage in position 1, make 1 plus turn. You can see that the decimal markers separate the year, month, and day on the RR.
Enter the earlier date in the SR in places 11 to 4 and make one minus turn. SR is 19901225000, after one minus turn the RR is 0031.95.78.000.
Note that if the day of either date is 31, it should be manually changed to 30. In this example neither date has a day of 31.
If the value in positions 4-5 of the RR (the days) is greater than 30, put 99999930000 in the SR and make one plus turn. In our example, this value is 78 so we put 99999930000 in SR and make one plus turn. RR is now 0031.95.08.000.
If the value in positions 6-7 of the RR (the months) is greater than 12, put 99991200000 in the SR and make one plus turn. In our example, this value is 95 so we put 99991200000 in SR and make one plus turn. RR is now 0031.07.08.000.
Put the carriage in position 1 and put 99999999001 in the SR. Make positive turns until the value in the days position (4-5 on the RR) goes to zero. In our example, this value was 08 so after 8 plus turns this will go to zero. We could also make 1 plus turn with the carriage in position 2 and 2 minus turns with the carriage in position 1. RR is now 0031.07.00.008.
Put 99999900030 in the SR and make positive turns until the value in the months position (6-7 on the RR) goes to zero. This value was 07 so again we can either do 7 plus turns with the carriage at 1 or 1 plus turn with the carriage at 2 and 3 minus turns with the carriage at 1. RR is now 0031.00.00.218.
Put 99990000360 in the SR and make positive turns until the value in the years position (11-8 on the RR) goes to zero. This value was 31 so we do one turn with the carriage in position 1 and three turns with the carriage in position 2. RR is now 0000.00.11.378.
Read the result off the RR. Ignore the digits in position 12 and higher. Result is 11,378. |
|