Microsoft used to supply two versions of its BASIC for Macintosh. One used decimal mathematics for precise tallying of small amounts. The other used the more familiar floating point mathematics, rounding errors and all. I don’t know what floating point library Microsoft used for sure — perhaps Motorola’s 32-bit Fast Floating Point system — but it introduces rounding errors pretty quickly. Modern routines don’t start displaying oddly until after 15 decimal places.
Consider this simple program:
10 LET x=36/10 20 LET a$="## #.#" 30 FOR n%=1 TO 18 40 PRINT USING a$; n%; x 50 LET a$=a$+"#" 60 NEXT n% 70 END
Along with the number of decimal places, it should print 3.6, 3.60, 3.600, 3.6000, … with an increasing line of zeroes after the 3.6. Bas makes a valiant but typical attempt:
1 3.6 2 3.60 3 3.600 4 3.6000 5 3.60000 6 3.600000 7 3.6000000 8 3.60000000 9 3.600000000 10 3.6000000000 11 3.60000000000 12 3.600000000000 13 3.6000000000000 14 3.60000000000000 15 3.600000000000000 16 3.6000000000000001 17 3.60000000000000009 18 3.600000000000000089
Oddly enough, good old Locomotive BASIC on the Amstrad CPC does it more correctly somehow: