Timeline for Examples of floating-point numbers that don’t round-trip losslessly through text conversion in Microsoft BASIC
Current License: CC BY-SA 4.0
6 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
May 6, 2023 at 14:22 | comment | added | Willis Blackburn | Sure, but then it needs to maintain a table of variable tokens. Pretty soon you've got Atari BASIC, which is great, but would never fit into 4K! | |
May 5, 2023 at 23:19 | comment | added | Maury Markowitz | Unless it parses variable names to tokens as well, of course. | |
May 4, 2023 at 21:05 | comment | added | Willis Blackburn |
The parser can't simply collapse numbers the same way it does with keywords because not everything that looks like a number actually is one. To parse LET X100=100 the parser would have to know that the thing after LET is a variable and that the first 100 is part of the variable's name. And it would have to make that same determination every place it sees X100, such as in expressions.
|
|
May 4, 2023 at 20:46 | comment | added | Willis Blackburn | I think MS BASIC's original 4K implementation is probably the reason for the unsophisticated approach to tokenizing constants. The parser doesn't do much besides convert keywords into tokens. In Applesoft, at least, unknown keywords and type errors aren't caught until run time. | |
May 4, 2023 at 20:43 | comment | added | Willis Blackburn | I thought that the tokenizer could use special tokens for these small-constant cases. However that really only works for integers; once you get into floating point, you pretty much have to store all 40 bits, because values that are simple in base 10 are usually not so simple in binary. So "0.1" probably requires 6 bytes, a "here comes a float" token, plus the 40 bits of the value itself. | |
May 4, 2023 at 12:37 | history | answered | Maury Markowitz | CC BY-SA 4.0 |