05-09-2007 02:44 AM
05-09-2007 03:07 AM - edited 05-09-2007 03:07 AM
05-09-2007 03:34 AM
Hi GerdW,
I tried this & understood what is happening, thats why my question...
From a beginner's point of view, this will be a bit confusing, that is what I meant indirectly. ![]()
05-09-2007 06:11 AM
05-21-2009 01:13 PM
Will the method of TypeCast still true for 64 bit floating point number?
I used C++ and the result I have is
1 = 3F800000 (32bits)
= 3FF0000000000000 (64bits)
I got the similar value with 32bits in LabView but different value for 64bits: 3F80000000000000 (64bits).
05-21-2009 01:14 PM
Oh, I sorry, I got answer myself:
32bits Single Precision
64bits Double Precision
06-12-2009 07:23 AM
I've got a similar problem in that my data (32-bit and 64-bit) are arriving as blocks of 4 or 8 bytes of strings.
I cast to 32 (or 64) float, then use the join numbers function to get the bits held as single 32 or 64 number format, but I now need to rotate through to identify the sign, exponent and fraction. But I've just discovered the rotate function drops the bits I want, so I'll have to chop about with very messy code. Is there an easier way?!
06-12-2009 09:35 AM
Your question is not completely clear. Can you provide more details on precisely what you're doing?
You may wish to start a new post on this so it gets more visibility. If you do, please make a note in this thread to indicate the discussion has moved.
06-12-2009 10:59 AM - edited 06-12-2009 11:00 AM
grahamwebb wrote:I've got a similar problem in that my data (32-bit and 64-bit) are arriving as blocks of 4 or 8 bytes of strings.
I cast to 32 (or 64) float, then use the join numbers function to get the bits held as single 32 or 64 number format, but I now need to rotate through to identify the sign, exponent and fraction. But I've just discovered the rotate function drops the bits I want, so I'll have to chop about with very messy code. Is there an easier way?!
None of this makes sense! Join numbers is for intergers (blue), not floats (orange), so it seems you are actually casting to integers. If you would cast to floats, the number will be correct, no need to dig bitwise into sign, exponent, or mantissa, everything will automatically fall into place.
(The only problem you might encounter, is byte order. If you string is little endian, you need to reverse the string first.)
06-12-2009 11:09 AM
It's been a long day!
Yes I cast to 8-bit ints, joined them and planned to rotate through to get signs, exp. etc. But as you say I have overlooked the bleedin' obvious - cast to 32 or 64 bit floats in the first place! .. which I have done in another part of the program!! arghh! where's my well-written documentation?