[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 10 bytes real




Thierry Wannier <thierry.wannier@unifr.ch> writes:

> Thanks for the idea, but unfortunately it does not solve my problem, since the
> data file really contains 10 bytes reals.
> I thought that a way to turn around the problem would be to
> a) read the ten bytes,
> b) reorder them in little-endian (PC type if I recall correctly)
> c) read the components of the number (i.e. decompose the real in its
> significand and exponent parts (that's how I do understand reals are build
> up))
> d) recompose a real (double precision: 16 bytes) using this information.
> 
> Unfortunately, I am no computer specialist but just a middle range user, and I
> have
> no idea about the possibilities of doing this decomposition/recomposition of a
> real number.

If you can do the research and find the specs on Intel 10-bit reals,
we can probably figures something out.

I found the following bit ranges:

            float  double  80-bit
sign           31      63      79
exponent    23-30   52-62   56-78
mantissa     0-22    0-51    0-55

It seems 10-byte format supports a *really* large exponent.  That's
pretty wierd.  You have it tough because 10-bytes is not an even
multiple of any of the IDL types.  Thus you will need to insert your
10xN array into a 16xN array and then convert to ULONG64.  Then the
bit twizzling comes.  Here ISHFT and AND will be your friends.

Craig


-- 
--------------------------------------------------------------------------
Craig B. Markwardt, Ph.D.         EMAIL:    craigmnet@cow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
--------------------------------------------------------------------------