Day of the week: Difference between revisions

m
m (→‎{{header|Phix}}: added syntax colouring the hard way, phix/basics)
Line 800:
==={{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 and quite unlike the ZX81's "first-generation" BASIC that's rather like using a calculator which also is without an integer type. Even so, it's worth the effort to optimise the code for the task at hand, as done below - which if implemented for the ZX81's routine would make it finish in a fraction of a second, even in SLOW mode, as multiplying by 13 with a division by 5 is slower than by 256 alone, as well as that two divisions by multiples of 100 are much slower than one by 16 as used in Lachman's method of calculating the day of the week.
BASIC that's rather like using a calculator (also without an integer type). Even so, it's worth the minor effort to optimise the
N.B. by relying on strings to have 4-digit years, this routine is not y10k-compliant
code for the task at hand, as done below - which if implemented for the ZX81's routine would make it finish in a fraction of a
second, even in SLOW mode, as multiplying by 13 with a division by 5 is slower than by 256 alone, as well as that two divisions by
multiples of 100 are much slower than one by 16 as at the link. N.B. by relying on strings to have 4-digit years, this routine is not y10k-compliant
<lang qbasic>
AUTO 100,10