Re: Layout floating point numbers

From: John (
Date: 2002-10-04 17:42:07 writes:

>- It says the first bit is used for the sign. So what is the function of $66

There are two floating point formats used in the C64.  "packed' has the
sign in the first bit, and occupies five(?) bytes.  'unpacked' has the
sign in a separate byte.  It's easier for processing, but takes more
memory.  Packed is used for variables, unpacked in the FACs.

>- If I understand well the other 31 bits hold the data representing the
>number right of the decimal point. But in what format? 

It's been a long, long time.  There should be one sign bit, some number
of exponent bits (probably stored in excess-N format), then the rest is
the fraction.

value = sign * 2^(exp-N) * 1.fraction

There are a few constants in the ROMs, such as 1.0, 10.0, PI, and a few
others.  You should be able to work out how many bits the exponent and
fraction take, and what the exponent excess is.


       Message was sent through the cbm-hackers mailing list

Archive generated by hypermail 2.1.4.