HP Forums
Fridays the 13th, ported to Prime - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: HP Prime (/forum-5.html)
+--- Thread: Fridays the 13th, ported to Prime (/thread-2860.html)



Fridays the 13th, ported to Prime - ggauny@live.fr - 01-14-2015 09:04 PM

Hi,
I've tryed port to Prime an jewel from Master Horn, Friday the 13 (see "one minute marvels" page 14), for superstitious!!! Normally i am allowed but i don't know.
Certainely it is possible do better because i am bad with PPL. Well you need 2 routines to do the job.
Code:
EXPORT Vend13(AN)
BEGIN
LOCAL A,B,C,G,L;
L:={};
B:=(AN/1000000)+13.01;

//13.011987▶B;
13.063▶C;

FOR A FROM 1 TO 13 DO
13.063;
DDAYSS(C,B)▶R;
IF NOT(R MOD7)
THEN B▶L(A);END;
IF A<14 THEN B:=B+0.01;
 
END;

END;
PRINT(L);
END;

EXPORT DDAYSS(D1,D2)
BEGIN
LOCAL a1,m1,j1,a2,m2,j2,z1,z2;
D1:=FP((D1)*100)*10000+IP(FP(D1)*100)
/100+IP(D1)/10000;
D2:=FP((D2)*100)*10000+IP(FP(D2)*100)
/100+IP(D2)/10000;
//YYYY.MMDD
a1:=IP(D1);//YYYY
m1:=IP(FP(D1)*100);//MM
j1:=IP(FP(FP(D1)*100)*100);//DD
//YYYY.MMDD(2)
a2:=IP(D2);//YYYY2
m2:=IP(FP(D2)*100);//MM2
j2:=IP(FP(FP(D2)*100)*100);//JJ2
IF m1<3 THEN m1:=m1+12;a1:=a1-1;
END;
IF D1≤1582.1004
   THEN B:=IP(−2+(a1+4716)/4-1179);
   ELSE B:=IP(a1/400-a1/100+a1/4);
END;
z1:=365*a1-679004+B+2400000.5;
z1:=z1+IP(30.6001*(m1+1))+j1+.5;
IF m2<3 THEN m2:=m2+12;a2:=a2-1;
END;
IF D2≤1582.1004
   THEN B:=IP(−2+(a2+4716)/4-1179);
   ELSE B:=IP(a2/400-a2/100+a2/4);
END;
z2:=365*a2-679004+B+2400000.5;
z2:=z2+IP(30.6001*(m2+1))+j2+.5;
RETURN ABS(z2-z1);
END;

For exemple Year 1987 give 13.02.1987 13.03.1987 13.11.1987
Year 1938 give 13.05.1938 13.13.1938

Surely it is possible to "ameliorer" Enhenced ?

Good night and regards, Gérard.


RE: Fridays the 13th, ported to Prime - Tim Wessman - 01-14-2015 09:16 PM

I really need to get the days/date functions added...


RE: Fridays the 13th, ported to Prime - ggauny@live.fr - 01-14-2015 09:42 PM

(01-14-2015 09:16 PM)Tim Wessman Wrote:  I really need to get the days/date functions added...

I am very honored that you speak me. Well i send this to a friend, i give you too. it is not complete i have others.

I beg for language, regards.


RE: Fridays the 13th, ported to Prime - ggauny@live.fr - 01-22-2015 09:46 PM

(01-14-2015 09:16 PM)Tim Wessman Wrote:  I really need to get the days/date functions added...

Dear Sir,

I have tested my littles programs, all seem good running. So i give them to you.

For thoses who are interested in calendars calculations, there are very important
things to note :

1/ Calculations calendars are strictly from 1/1/-4712 up to 31/12/9999, after the precision goes down (dangerous when calculate astronomy or pursuit artificial satellites for example).

2/ Most importants programs are :
a/ D2JDc (DATE TO JULIAN DAY number, c stand for calcs only numericals),
ex : D2JDc(23.021951) return number 2,433,701. But
D2JD (23.021951) return one comment, if needed, like
"23.021951=2433701" not numeric

b/ JD2Dc (JULIAN DAY number TO DATE, c is the same signification)
ex : JD0Dc(2,433,701) return 23.021951, numeric date. But
JD2D (2,433,701) return a text comment like for example :
"Vendredi 23.021951 (JDN=2,433,701)

3/ To build a calendar, it is needed to know the day of the first month of a year,
FIRSTDAYOFYEARMOD give us the day of week, the date numeric and the
JDN of this day :

Ex : FIRSTDAYOFYEAR(2015) return :
"Jeudi 1.012015 (JDN = 2457024). I have subroutines by month yet.

I hope not have disturbed you.

My best regards.

Gérard. (i send you a big part of my programs, not calendar for any year because it is not possible to print, but i have always my 2 HP41, one C and the other CX).


RE: Fridays the 13th, ported to Prime - ggauny@live.fr - 01-22-2015 10:11 PM

(01-14-2015 09:16 PM)Tim Wessman Wrote:  I really need to get the days/date functions added...

Please take care only with this new zip.bis, in first zip are 2 mistakes. Apolozise !

I hope theses littles codes will helpfull for you.

Gérard.


RE: Fridays the 13th, ported to Prime - Thomas_Sch - 01-23-2015 01:24 PM

(01-22-2015 10:11 PM)ggauny@live.fr Wrote:  ... Please take care only with this new zip.bis, in first zip are 2 mistakes. Apolozise !
I hope theses littles codes will helpfull for you.
Gérard.

Hello Gérard,

date/ calender functions exists already in the Software Library, please have a look at
Date Functions
I don't think, that we need too much of them.
If there are errors or missing functions, you can add a question or send a PM to Wolfgang.

Thomas


RE: Fridays the 13th, ported to Prime - Dieter - 01-23-2015 09:10 PM

(01-14-2015 09:16 PM)Tim Wessman Wrote:  I really need to get the days/date functions added...

If they are currently missing (sorry, I don't own a Prime) I think adding these would be a major improvement.

You could even top the WP34s by adding a configuration setting that's missing there: a user-adjustable transition point between the Julian and Gregorian calendar (defaulting to 04/15 Oct 1582). This can be accomplished quite easily, as shown in the VBA code in this message in the Prime software library.

Dieter


RE: Fridays the 13th, ported to Prime - Thomas_Sch - 01-24-2015 09:14 AM

(01-23-2015 09:10 PM)Dieter Wrote:  ...
If they are currently missing (sorry, I don't own a Prime) I think adding these would be a major improvement.
..
Dieter
Hello Dieter,
there are Prime's "for free" at http://ftp.ftp.hp.com/pub/calculators/Prime/,
the HP_Prime_Virtual_Calculator_2014_12_03.exe including manuals etc.

Thomas