[Tutor] Re: Base 207 compression algorithm

Derrick 'dman' Hudson dman@dman13.dyndns.org
Sat Jun 28 01:41:02 2003


--PNTmBPCT7hxwcZjr
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Thu, Jun 26, 2003 at 05:38:50PM -0700, Jeff Shannon wrote:
[snip the rest of Jeff's (IMO) accurate comments]
| I don't remember specifics on the numbers of significant digits that
| are expressible with a standard C float or double

Ooh, ooh, I do.  :-).  (it wasn't that long ago when I was required to
implement IEEE 754 single-precision floating point addition and
subtraction on the integer-based M68k in assembly for class)

A single-precision float is 32 bits.  The first bit is a sign bit, the
next 8 are the exponent and the last 23 are the mantissa.  There is an
"invisible" 1 in the mantissa there due to the normalization performed
before packing the number into the float.

If you've ever seen scientific notation you'll understand where these
component of the numbers come from :
        m + 10**e
m is the mantissa, e is the exponent.  With scientific notation the
mantissa is always of the form d.xx where 'd' is a single base 10
digit (not 0) and xx is whatever fractional part is appropriate.  IEEE
754 floats have a little twist to them, however.  The mantissa is base
2 instead.  So the mantissa is always of the form 1.xx (where xx is
base 2).  That's where the "invisible" 1 comes from that I mentioned
earlier.

If this interests you, check out this page :
    http://babbage.cs.qc.edu/courses/cs341/IEEE-754.html
The form allows you to enter a decimal floating point value
(ascii-encoded, naturally :-)) and then displays the the components of
the binary value as stored in the computer (also ascii encoded,
naturally).

(By the way, a float can represent numbers ranging from negative
infinity to positive infinity, though the precision of the numbers in
between varies with it's position along the number scale)

HTH!
-D

--=20
A man of many companions may come to ruin,
but there is a friend that sticks closer than a brother.
        Proverbs 18:24
=20
http://dman13.dyndns.org/~dman/

--PNTmBPCT7hxwcZjr
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iEYEARECAAYFAj79KjwACgkQiB6vp1xAVUACPwCfYRmgpDu9ysTjHtO5rvNOl7bY
5FgAnjzkx9KguWPMGLbRe+a1ERhlMCmd
=dWsI
-----END PGP SIGNATURE-----

--PNTmBPCT7hxwcZjr--