I ran some experiments on
BeebEm to see how expensive it is to deal with floating point values.
Note that
the code in the 4.32
version of
BBC BASIC is a lot quicker than that in
earlier versions: it takes 0.8 milliseconds to multiply two 5-byte numbers on a 3MHz 65C02, compared to 1.2 milliseconds in version 3.
The relative cost of trig functions is improved too: I think the older basic uses a polynomial for each, whereas the newer one uses(*) the ratio of two polynomials, which gets more accuracy for less work. The following figures are calculated as an equivalent number of multiplies:
Code:
hibasic3 basic 4.32
sqrt 5.3 2.3
sin 8.6 8.1
cos 14.4 10.8
tan 22.3 11.8
atn 10.7 8.8
Edit: Basic2 source is
here or
hereEdit: (*) actually uses some other trick - continued fraction?? See
here although it mostly duplicates the basic4 documentation linked above.
Edit: repaired some broken links: beebwiki is now found at
http://beebwiki.mdfs.net