Coding could be like this or similar?
I (:: numeric digits 2) = 0
Do I = 1 to 12
...
End
Greetings
Franz
Franz Marx <[email protected]> schrieb am Mi., 16. Feb. 2022, 11:22:
> Dear fellows!
> i have written a simple Rexx-Program to calculate the first 150.000
> primes, for performance monitoring i collect the number of compares like
> this
>
> NR.0 = ANZ /* Prime-Table - STEM */
>
> NR.1 = 2; /* first Prime */
> NR.2 = 3; /* 2. Prime */
> P=3; /* starting Prime */
> N = 2 /* last STEM . nr */
> PRI=0 /* reset Prime-Indicator */
> VO=0 /* Compare-Operations 1-999999 */
> MVO=0 /* Compare-Count-Millions */
>
> DO I=2 TO ANZ
> P=P+2; /* perhaps next Prime ? */
>
> DO Until (PRI=1) /* vergleichen bis Primzahl gefunden */
> DO J=2 TO N /* von 2. bis letzter errechneter Zahl */
> VO=VO+1 /* Vergleiche um 1 erhöhen */
> IF (P//NR.J)=0 THEN Do
> PRI=0 /* P = no Prime */
> P=P+2 /* add 2 to possible Prime */
> Leave J /* leave inner Do-Loop */
> End
> Else PRI=1 /* Prime still possible */
>
> END J
> End
>
> N=N+1 /* our next STEM-NR */
> NR.N=P /* new PRIME into STEM */
> PRI=0 /* reset Prime-Indicator */
> IF (N//1000) = 0 then Do
> THT = TIME()
> LS = TIME("S")
> DS = LS - FS
> ZVO = RIGHT(VO,15)
> FVO = RIGHT(ZVO,20)
> /*
> ---------------------------------------------------------- */
> /* following Routine is faster than-> numeric
> digits 15 */
> /*
> ---------------------------------------------------------- */
> IF SUBSTR(ZVO,9,1) \= " " THEN DO
> MVO = MVO +
> SUBSTR(ZVO,1,9)
> VO =
> SUBSTR(ZVO,10,6)
> ZVO =
> RIGHT(MVO,9)||VO
> END
> /* --------------------------------------------
> */
> /* format Monitor-NR with 1000er Points */
> /* --------------------------------------------
> */
> SELECT
> WHEN SUBSTR(ZVO,12,1)=" " THEN FVO =
> RIGHT(ZVO,20)
> WHEN SUBSTR(ZVO,9,1) =" " THEN FVO =
> SUBSTR(ZVO,1,12)"."SUBSTR(ZVO,13,3)
> WHEN SUBSTR(ZVO,6,1) =" " THEN FVO =
> SUBSTR(ZVO,1,9)"."SUBSTR(ZVO,10,3)"."SUBSTR(ZVO,13,3)
> WHEN SUBSTR(ZVO,3,1) =" " THEN FVO =
> SUBSTR(ZVO,1,6)"."SUBSTR(ZVO,7,3)"."SUBSTR(ZVO,10,3)"."SUBSTR(ZVO,13,3)
> OTHERWISE FVO =
> SUBSTR(ZVO,1,3)"."SUBSTR(ZVO,4,3)"."SUBSTR(ZVO,7,3)"."SUBSTR(ZVO,10,3)"."SUBSTR(ZVO,13,3)
> END /* SELECT */
> FVO = RIGHT(FVO,20)
> SLINE = THT RIGHT(DS,5) "sec" RIGHT(N,6)
> "Primzahlen errechnet nach" FVO "Vergleichsoperationen"
> say SLINE
> FS = LS
> RC = 0;
> CALL LINEOUT logfile,SLINE /* write Logline
> */
> IF RC <> 0 then Do
> Say "CALL LINEOUT" logfile
> SLINE "fails with RC" RC
> Signal Ende
> End
> End
> END I
>
> When i used the *REXX-Option numeric digits 15* to simplify my own
> coding,
> i got a doubled elapsed time!
>
> Therefore i think it would be nice to delimit the numeric digits option to
> single variables.
> Of course, i don´t know, what this means for you as developers!
>
> 2nd question: when will you release the Windows 64-Bit Release V5
> officially?
>
> Yours Sincerely
> Franz
>
>
_______________________________________________
Oorexx-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/oorexx-devel