[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Basic compiler
In article <JradnWOVdZ8HoKPY4p2dnA@telenor.com>,
Knut Roll-Lund <kr-lund@nogarbage.online.no> wrote:
> Paul Schlyter wrote:
...............
>> So Applesoft do have integer variables, but no integer arithmetic.
>> And the operation
>>
>> 30000 * 10
>>
>> won't overflow, because it is performed in floating-point arithmetic.
>> In MBASIC, the operation 30000% * 10% *will* overflow !!!!
>
> I'm surprised, on the TRS-80 which also has Microsoft basic, though a
> bit differently looking, does integer operations on integers (and it is
> an important point to use integers for speed). This is so except for
> division where the actual division is done in single precision. Even
> constants are done as integers as long as they fit.
>
> The Microsoft basic came with the TRS-80 (Model I) Level II that came in
> August 1978. The original TRS-80 Microcomputer (Model I Level I) from
> August 1977 had a basic that was made by Tandy famous for its error
> messages: 3 in all WHAT?, HOW? and SORRY (means syntaxerr, outofrange
> and outofmemory respectively). :-)
The TSR-80 was an 808 or Z80 based computer. Microsoft did put considerably
more effort into its Basic interpreters in 8080 assembly language than
the interpreters in 6502 assembly language.
The Applesoft (as well as the Commodore PET and C64) Basic had one
advantage in its floating point though: better precision than normal
single precision. Single precision f.p. numbers usually occupy 4
bytes, which leaves room for 6 or 7 decimal digits of precision.
Double precision occupies twise as much, 8 bytes, giving 14 to 16
decimal digits of precision. Applesoft Basis used 5 bytes for its
floating point, which gave 9 or 10 decimal digits of precision.
(early versions of Turbo Pascal, which used software floating point,
used 6 bytes for its f.p. numbers, yielding sime 12 decimal digits of
precision)
> --
> Knut
> (delete 'nogarbage.' for email)
--
----------------------------------------------------------------
Paul Schlyter, Grev Turegatan 40, SE-114 38 Stockholm, SWEDEN
e-mail: pausch at stockholm dot bostream dot se
WWW: http://stjarnhimlen.se/