Day of the week: Difference between revisions

m
m (→‎{{header|BASIC}}: corrected formatting error, I hope)
Line 683:
 
==={{header|QL SuperBASIC}}===
<b>Works with:</b> [https://en.wikipedia.org/wiki/Sinclair_QL ''Sinclair QL''] <br>
...having a structured [https://en.wikipedia.org/wiki/SuperBASIC ''BASIC''] with MOD & DIV - quite unlike the ZX81's "zeroeth" -generation" BASIC that's rather like using a calculator. Even so, one should still put forth the effort into optimising the code for the task at hand., Whatas is useddone below would- makewhich if implemented for the ZX81's routine would make it finish in a fraction of a second, even in slow mode, as two divisions by multiples of 100 are much slower than a single division by 16 isas muchused fasterin than[gopher://sdf.org/0/users/retroburrowers/TemporalRetrology/cc/os by''Lachman's amethod''] coupleof multiplescalculating the day of 100the week.
 
<lang basic>
Line 699:
REM skipping unnecessary years below
FOR count=S TO O
LET y$=count : w%=(y$(1TO 2)&"32"DIV 16+ count DIV 4+ count+ n%)MOD 7
REM or by using w%=(y$(1TO 2)&"16"DIV 16+ count DIV 4+ count)MOD 7 as further optimisation
IF w%=0 THEN PRINT count : count = count+ 4
END FOR count
END DEFine
 
{{keypress|ctrl|space}}
</lang>