I'm now working in ICE, should I also make a TIBASIC version? 
definitely! 

45% 
[ 5 ] 
Absolutely not! 

18% 
[ 2 ] 
Just make the main version in TIBASIC! 

36% 
[ 4 ] 

Total Votes : 11 

What do you mean?
(I'm very new to working with and programming for the calculator)
The output is already stored in str9 as weekday and in W as number.
stbradley
I was looking at the program you posted above and thought the calculations looked familiar. I compared it to a program I wrote long ago that had a similar calculation to compute the Julian Day number from a calendar date. Even some of the variable names were the same. It was for an Astronomy program I wrote. I used the example calculations from the book Astronomical Algorithms by Jean Meeus. I was just wondering if you also had a copy of that book. It’s filled with a lot of calculations used for computing the positions of the planets and moons and other astronomical events for different dates, past or future. One chapter (8 pages) explained the use of Julian dates and how to calculate them with several examples. I find the book very interesting, but then I like books with a lot of calculations in them.
stbradley wrote:
ClrHome
Disp "ENTER DATE AS"
Input "(MMDD:YYYY):",G
iPart(abs(G)/100)→M
iPart(abs(G)M*100)→D
fPart(G)*10000→Y
If M≤2:Then
(Y1)→Y
(M+12)→M
End
If ((Y=1582) and (M=10)) and (D>4 and D<15):4→D
If (Y>1582) or (Y=1582 and M>10) or (Y=1582 and M=10 and D≥15):Then
int(Y/100)→A
(2A+int(A/4))→B
Else
0→B
End
remainder(int(365.25(Y+4716))+int(30.6001(M+1))+D+B1523,7)→θ
Disp θ
Return
You should use code tags
I went ahead and golfed it down a little bit. I'm sure there's still a few more optimizations that I haven't added
Code: ClrHome
Disp "ENTER DATE AS
Input "(MMDD:YYYY):",G
iPart(sub(abs(G→M
iPart(abs(G)E2M→D
E4fPart(G→Y
If M≤2:Then
Y1→Y
M+12→M
End
If Y=1582 and M=10 and D>4 and D<15:4→D
2→A
If Y>1582 or (Y=1582 and M>10) or (Y=1582 and M=10 and D≥15
int(sub(Y→A
remainder(int(365.25(Y+4716))+int(30.6001(M+1))+DA+int(A/4)1521,7
If the last line is valuereturning, it will be displayed.
You don't need to close your parentheses.
You have a couple rare opportunities to use the sub() command to divide by 100 (sub(A) will return A/100)
Also 2A+int(A/4) will be 0 if A=2, so you can use that to shrink down the code a little.
Greetings
dave1707 wrote:
I was looking at the program you posted above and thought the calculations looked familiar. I compared it to a program I wrote long ago that had a similar calculation to compute the Julian Day number from a calendar date. Even some of the variable names were the same. It was for an Astronomy program I wrote. I used the example calculations from the book Astronomical Algorithms by Jean Meeus. I was just wondering if you also had a copy of that book.
You are correct and have a good memory and yes I was lazy and used the same variables as are in that book because it is easier to debug. I almost pulled that calculation from Meeus' other book Astronomical Formula for calculators which uses a slightly different method. I have a rather large collection of textbooks and papers that deal with the subject of astronomical calculations which I find interesting.
If you like this sort of thing you may be interested in a C library I wrote called The Astronomical Papers Library (APL). It can be downloaded from SourceForge
https://sourceforge.net/projects/astronomicalpap/
mr womp womp: Cool. I spend the majority of my programming time writing C programs so I'm used to strict C syntax rules which carries over to my TIBASIC. I only consider myself an average TIBASIC programmer and have only read Kerm Martian's book once 4 or 5 years ago so I don't recall all the shortcuts. However, I would be interested in any other ways you might come up with to squeeze down my code as I find this interesting.
I've just changed stuff in the 'lite' version of the program, so now it is only 1,6KB!
I just hope that everything still works as it should...
And with this change, I might also be able to bring down the file size of the normal BASIC version, if I there make the same change, but I'll have to look at that later.
You can find it on the beta branch on the Github repository (
https://github.com/PrivacyDragon/DayofWeekTI84PlusCE/tree/beta)
stbradley;
I downloaded your APL code. It’s written in C so I probably won’t do anything with the code except look thru it. I used C by profession for many, many years, but I’m retired now and code on the iPad using Lua. I have several astronomy programs on the iPad along with hundreds of other programs that I wrote just for kicks. I have several books on astronomy and orbit calculations that I’ve had for many years. My first astronomy program was written in basic on an Apple II and was published in the Micro magazine back in 1980. I had other programs that were in Byte magazine and in the AppleSoft books. I have several TI calculators that I code on every now and then, but they don’t come close to the ease of the iPad. I recently got an iPhone and was able to copy all my programs to it (600+). I can write Lua code on the iPhone, but the screen is really small compared to the iPad.
Privacy_Dragon;
Sorry for posting something different in your discussion.
I learn actually more from this project than I expected at first!
There were so many exceptions of countries that switched...
There are areas that switched to the Gregorian calendar and later changed back to Julian, and thereafter again to Gregorian. ..
One country also changed side of the international dateline when they switched to the Gregorian calendar, so the change was one day less than normal...
Then there is Sweden and Finland, they used several years another calendar with the goal to gradually switch to Gregorian calendar, but they forgot something some years so it didn't work. Then they switched back to Julian calendar and later switched to Gregorian calendar. ..
Then there is Turkey, there they switched to the Gregorian calendar, but still did something different for a time...
This project is a little bit cursed...
Yesterday I found out still the small (beta) version had big problems and it was actually hard to fix those...
But now I have something again and I really hope that it hasn't bugs anymore...
Today I'll ask my standard betatester for this program to test it...
Privacy_Dragon wrote:
This project is a little bit cursed...
Yesterday I found out still the small (beta) version had big problems and it was actually hard to fix those...
But now I have something again and I really hope that it hasn't bugs anymore...
Today I'll ask my standard betatester for this program to test it...
Will that affect the Organizer at all? Could you test it out to make sure I got it working right?
https://www.cemetech.net/downloads/files/2025/x2177
RoccoLox Programs wrote:
Sadly, yes...
I've looked at it this morning, and very sadly the organizer has the problems of this too...
I hope to receive feedback today or tomorrow from my betatester, since I've today given him the newest beta version.
But I have found where the problem was, so I hope it's now fixed, but until I've had that confirmed I don't dare to say that for sure.
But it's only with the julian dates.
Privacy_Dragon wrote:
Sadly, yes...
I've looked at it this morning, and very sadly the organizer has the problems of this too...
I hope to receive feedback today or tomorrow from my betatester, since I've today given him the newest beta version.
But I have found where the problem was, so I hope it's now fixed, but until I've had that confirmed I don't dare to say that for sure.
But it's only with the julian dates.
Darn. Please send me the fixed version ASAP.
I'll be working hard on it today during the moments I can find time.
(Maybe during some boring lessons won't be a good idea though...)
And as soon as I've got it ready and working and correct.., I'll send it !
I've fixed it!
Later today when I'm home I'll send it!
(I was working to fix this when travelling to school with the bus: seeing that the next bus is already about to go so having to run with bag and calculator in one hand, calculator case and phone in the other... I think that looked strange...)
The small version of the day of week program is uploaded!
You can download it
Here!
Privacy_Dragon wrote:
The small version of the day of week program is uploaded!
You can download it
Here!
Thank you very much Privacy_Dragon! I'll be putting that into the next version of the Organizer.
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with likeminded coders and tech and calculator enthusiasts via the sitewide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.
»
Go to Registration page
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum