01-17-2012 10:59 PM
hi,
i would like to know how to write last 48bits of double type variable. i am trying create a certain memory format. it needs a 48bits of a one data point. since we C doen't have 48bit variable i created double variable. now i am trying to write last 48bits of this double.(most significant bits). any help would be appreciated.
Thanks,
01-18-2012 02:03 AM
Double variables are treated by CVI according to IEEE 754 standard, which means the 64 bits are organized in groups to represent sign, exponent and mantissa of a floating point library. For this reason it seems to me that you may come into troubles by attempting to use some bits only of a double variable.
If you are not treating floating point numbers, you may consider to use '__int64' data type instead which is supported by CVI starting from release 7.0 on or the equivalent 'long long' data type introduced in CVI 8.5: both describe 8-bytes integers.
01-18-2012 08:44 AM
Thanks for the reply Roberto. If i use '_int64' data type how can i get last 48bits of that data type to write to the disk? Or does labview support integer 48bit data type? the memory format i am trying to create requires this data to be 48bits.
Thanks
01-18-2012 12:02 PM
I'm not aware of any 48-bit data types so you'll have to make do with something like three short types. Something like this should work (from the interactive execution window):
static double d64 = 1234567890.0; static short *s; static short first16, second16, third16; s = (short *)(&d64); first16 = *(s + 0); second16 = *(s + 1); third16 = *(s + 2); DebugPrintf("%d, %d, %d", first16, second16, third16);
Where the short ints first16, second16, and third16 will give you the first, second, and third set of 16 bits from the double, respectively. I have no idea how to do that in Labview. Please note that this is the Labwindows forum.