5 ms·
C64 Basic did have integers. A floating point A$ string A% int as you would expect ints are quicker.
by Woansdei 4mo ago
C64 Basic did have integers.
A floating point
A$ string
A% int
as you would expect ints are quicker.
- izacus 4mo agoErr, ints are internally stored as floats as well and that leads to some really interesting performance quirks where you'd not expect. There were BASIC compilers for C64 which generated significantly faster code just because they actually used ints for integer operations.
- RiverCrochet 4mo agoNot on C64 BASIC. C64 BASIC converted ints to floats internally and converted them back to ints when needed. What sidestepped part of that conversion was using variables instead of literal constants. So, doing something like N0=0, and using the variable N0 instead of 0 was faster. Additionally, C64 looked up variables in the order they were defined, so variables defined later were slower. If your program used 0 a lot, you'd want to have N0=0 as the first statement in your program. I typically had N0=0 and N1=1 as those were common to use. QBasic was so much faster and implemented differently. DEFINT A-Z at the top of the program typically sped it up significantly if you didn't use floating point. This might have worked on GW-BASIC as well.