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

Home » Public Forums » archive » Please HELP!!!!!
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: Please HELP!!!!! [message #4934 is a reply to message #4866] Wed, 23 August 1995 00:00 Go to previous messageGo to previous message
pjclinch is currently offline  pjclinch
Messages: 27
Registered: May 1993
Junior Member
Phil (phil@peace.med.ohio-state.edu) wrote:
: Howdy,

: I have a problem that is only loosely related to IDL that I hope one
: of you can help me out. I want to take the bytes from a 32-bit
: floating point number and determine the floating point value of it.

: Now, here is the problem. I'm trying to get the same answer by hand
: and can't seem to do it. I have been doing all sorts of interations
: to get the sign, exponent and mantissa for this and nothing seems to
: work. I know this is simple, but I just seem to be missing something.
: Could one of you people out there humble me and show me what I am
: doing wrong.

First of all, the format will depend on your system. VAXen use a
unique floating point format, I think, but other than that it's probably
IEEE 753-1985, which is the main standard.

format for a 32 bit float is:

bit 31: sign bit, 1 -> negative, 0 -> positive
bits 30-23: exponent
bits 22-0: significand

the problem interpreting these is usually in the significand, which is,
not very intuitively at first sight, a binary fraction greater or equal
to 1 and less than 2. I think (but can't be totally sure offhand) that
all the significand bits set at 0 is equivalent to an actual value of 1,
while all set at 1 is not quite 2, with fractional points in between.

the other fun bit is the exponent, which you get by subtracting a bias
value of 127. This allows you to get negative exponents, so an actual
bit value of 130 in bits 30->23 would mean an exponent of 3 for the
actual number represented.

Have fun...,
Pete.
--
Peter Clinch Dundee University & Teaching Hospitals NHS Trust
Tel 44 1382 660111 x 3637 Medical Physics, Ninewells Hospital
Fax 44 1382 640177 Dundee DD1 9SY Scotland UK
net p.j.clinch@dundee.ac.uk http://www.dundee.ac.uk/MedPhys/
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: hdf converter?
Next Topic: PVWAVE - widgets

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

Current Time: Fri Oct 10 10:29:13 PDT 2025

Total time taken to generate the page: 0.40147 seconds