[net.micro.cbm] Floating exception report

daemon@decwrl.UUCP (02/06/84)

From: vogon::goodenough  (Jeff Goodenough, IPG Basingstoke)
I was very interested to read Ray Miller's articles (2 to date) on using
the C64's BASIC ROM Floating Point routines.  However, I must take issue on
a very fundamental point : although a 6-byte floating point format as he
describes is used internally, all variables and constants (which is what
the user works with) are stored in a 5-byte format. The first byte (at the
lowest address) is the exponent, followed by four bytes of mantissa. The
sign is held in bit 7 of the first mantissa byte (the 2nd byte of the 5-byte
number).

Maybe Ray is getting round to this, but I felt I should point this out to
avoid (generate?) confusion.

Another point of interest is that a zero exponent represents absolute zero
- as far as I can see, the mantissa contents are ignored in this case. This
is borne out by a funny quirk of C64 basic:  if you say X=0, this is stored
as $00 00 00 00 00, whereas if you say X=0.0, this is stored as
$00 20 00 00 00!  (or maybe the 20 should be 32 - I can't remember whether
I was printing in decimal or hex when I discovered this.)

I have also done a fair amount of research on these routines but I'll leave
Ray to carry on with his excellent series.  If I have any other points to
raise I'll do so!

Jeff
(from rainswept England).

	UUCP:		... decvax!decwrl!rhea!vogon!goodenough
			...allegra!decwrl!rhea!vogon!goodenough
			... ucbvax!decwrl!rhea!vogon!goodenough

	ARPA:		decwrl!rhea!vogon!goodenough@Berkeley
			decwrl!rhea!vogon!goodenough@SU-Shasta

miller@uiucdcs.UUCP (miller ) (02/09/84)

#R:decwrl:-544900:uiucdcs:36100038:000:338
uiucdcs!miller    Feb  9 00:08:00 1984

I stand corrected.
Jeff is absolutely right on his comments about internal/external representation
of the c64 floating point numbers.  My description of the "memory to F1" and
"F1 to memory" subroutines mentioned the 5 byte/high mantissa sign format (see
part 3 of the series) but this certainly was unclear.

A. Ray Miller
Univ Illinois