[comp.compression] Compressing real values?

jbaker@gmuvax2.gmu.edu (John Baker) (04/26/91)

We need to compress a series of real values to transfer over a network
for a parallel program in Linda.  The values are somewhat related,
but a maximum difference is not always guaranteed.

What I would like is a program to compress the differences such that
smaller differences take fewer bytes.  This is trivial for integers,
but not necessarily reals.  I would think there would be some variant of
arithmetic coding to do this.

Alternatively, we could assume differences fit into n bits with a
special case if the value is too large, but this method probably would
be less effective.

Any ideas?

John Baker
jbaker@gmuvax2.gmu.edu

turk@Apple.COM (Ken "Turk" Turkowski) (05/02/91)

jbaker@gmuvax2.gmu.edu (John Baker) writes:

>We need to compress a series of real values to transfer over a network
>for a parallel program in Linda.  The values are somewhat related,
>but a maximum difference is not always guaranteed.

>What I would like is a program to compress the differences such that
>smaller differences take fewer bytes.  This is trivial for integers,
>but not necessarily reals.  I would think there would be some variant of
>arithmetic coding to do this.

>Alternatively, we could assume differences fit into n bits with a
>special case if the value is too large, but this method probably would
>be less effective.

Here's a few methods:

*       Why don't you just not send the least significant zeros?

*       Another way is to subtract two floating-point numbers as
though they were integers (i.e. hack it with a union).  IEEE
floating-point numbers are very similar to integers for comparison
purposes: if two numbers have the same sign, then comparing them
as integers produces the same results as subtracting them as floats
and checking the sign.

If two floating-point numbers are close to each other, then
subtracting them as integers will produce a small integer.  You
then throw out the most significant zeros.

*       Scan the data set for the dynamic range of the data or
their differences, convert to fixed-point, and compress them as
integers.  This method, unlike the previous two (which are lossless),
is inherently lossy.
-- 
Ken Turkowski @ Apple Computer, Inc., Cupertino, CA
Internet: turk@apple.com
Applelink: TURK
UUCP: sun!apple!turk