LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Handle a Uint64?

Hi,
I'm wondering if there is any way to handle a UINT64 (received via UDP from another source, comes in as a message string) in Labview. I've tried splitting it up into 2 doubles and then rejoining the bits but it loses the precision that I need. I'm open to any ideas, have not been able to find almost anything in this forum on this topic,
Thanks
0 Kudos
Message 1 of 9
(4,478 Views)
Don't split it into doubles. Split it into two Uint32s and perform all your operations thusly. Doubles do lose precision.

Splitting into 32 Bit numbers is how it is all done on a system level anyway. Keeping it to 32Bit integers assures you of accuracy. It is a little bit more difficult to handle the numbers, but it's really not that hard, and the results will be exactly what you need.

Email me if you need more help, or just post here. I will be checking once in a while...
0 Kudos
Message 2 of 9
(4,478 Views)
Hi,
I think it all comes down to the fact that I need to display the UINT 64 as an integer. I'm splitting it into U32's A, B, converting each U32 to an (ext) type, then I use (ext)A + 2^32 * (ext)B to get an (ext) type for my display but when it gets displayed it loses precision in the last few digits. Is there any way to get around this? So ideally I need to display the UINT64 as something so that it looks like the same number that was sent across, be it an ext, double, string indicator, does not matter, any ideas?
Thanks
0 Kudos
Message 4 of 9
(4,478 Views)
You could feed the two U32s in "Format into String" with the format %016x%016x and write to a string indicator or write the 8 bytes string received from U
UDP to a string indicator with Hex Display enabled.


LabVIEW, C'est LabVIEW

0 Kudos
Message 5 of 9
(4,478 Views)
Hi,
Thank you for you suggestion, but the problem is that I don't need it displayed in HEX format. I need it displayed as a number (decimal/integer format) Is HEX the only way to display it? Thanks
0 Kudos
Message 6 of 9
(4,478 Views)
You need to implement arbitrary precision VIs... I know that Greg McKaskle has this kind of library (http://messages.info-labview.org/2000/03/17/02.html) maybe he is willing to share?


LabVIEW, C'est LabVIEW

0 Kudos
Message 7 of 9
(4,478 Views)
> You need to implement arbitrary precision VIs... I know that Greg
> McKaskle has this kind of library
> (http://messages.info-labview.org/2000/03/17/02.html) maybe he is
> willing to share?
>

These VIs were given out at NIWeek a couple years ago. I you don't
manage to find them, I can arrange for them to go on devzone or something.

Greg McKaskle
0 Kudos
Message 8 of 9
(4,478 Views)
HI,
The link just takes me to a text file, is there any way you can just attach the vi to a reply. I just need one that takes a Uint64, or it's halves (2 U32's, or a U64 in hex) and displays it in a numeric format (non HEX), or tell me what link I can access them at,
Thanks
0 Kudos
Message 9 of 9
(4,478 Views)
Uint64 are not directly supported. However, extended precision numbers have 64 bits mantissa and then can perform exact arithmetics on integer up to 2^64. Set an extended to (ext)A + 2^32*(ext)B and perform your computations.
One pitfall: extended precision numbers are *displayed* with the precision of doubles, probably because internally, LabVIEW display routines use double precision numbers. So on display, you are limited to see 14 significant digits in spite the fact the extended number has about 20 significant digits. For full precision on display or hex display, you may have to implement your own routines, splitting the extended back to 2 U32.
Good luck.


LabVIEW, C'est LabVIEW

0 Kudos
Message 3 of 9
(4,478 Views)