comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Accessing bits in a floating point number
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Accessing bits in a floating point number [message #10427 is a reply to message #10424] Fri, 21 November 1997 00:00 Go to previous message
Kevin Ivory is currently offline  Kevin Ivory
Messages: 71
Registered: January 1997
Member
Brian Chafin wrote:
> I am reading a 16-bit floating point number from an HDF file. This
> 16-bit number was originally two 1-byte integers which were stuffed into
> a 16-bit float. This was done in C and don't ask why it was done this
> way.
>
> When the float is read into IDL using the native IDL HDF commands, the
> result is a 32-bit float.
>
> Is there any way to extract the original two 1-byte integers from this
> IDL float?

I have never heard of or used 16 bit floats, but if you want to reverse
the 32 bit float to a 16 bit float it seems you will have to know the
bit positioning of both. I am not familiar with HDF either, but in a
normal binary file I would read of either a 16 bit integer and
do the byte-extracting from that or read the two 8 bit integers straight
out of the file. How about giving the HDF declaration the data type
INT DFNT_INT16 and going on from there?

Best regards
Kevin
--
Kevin Ivory Tel: +49 5556 979 434
Max-Planck-Institut fuer Aeronomie Fax: +49 5556 979 240
Max-Planck-Str. 2 mailto:Kevin.Ivory@linmpi.mpg.de
D-37191 Katlenburg-Lindau, GERMANY http://www.gwdg.de/~kivory2/
[Message index]
 
Read Message
Read Message
Previous Topic: ION (IDL on Net) any remarks to it?
Next Topic: matlab conversion

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Sat Oct 11 22:07:44 PDT 2025

Total time taken to generate the page: 1.18216 seconds