LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Need help writing a 64-bit number to Excel worksheet

Hello again.

I need your help again. This time, I need a simple, but efective way to take a string (it's all numeric) that's greater than 32 bits, convert it to a number, and write it to an Excel worksheet. I've tried writing to it as an extended floating point number, as well as a double precision floating point number, but I always end up with a number valued at 2^31. Is there some way I can break down the string into 32-bit chunks, manipulate it and rearrange it in the form of a number that's greater than 32 bits?
0 Kudos
Message 1 of 5
(6,078 Views)
Hi Azmat,

I simply opened the shipping example "Write Table to XL.vi" and replace the value of "2" in the table with "2000000000000000000000000000000000000000000" and ran the example. It opened up Excel and place "2E+42" in the corresponding cell, so it appears to have worked okay. I'm using LabVIEW 6.1 and Excel 2002.

This, of course, is a floating point number, so it doesn't actually contain that many significant digits. I was not able to create a true 64bit integer value on my computer whether it was in LabVIEW or Excel (which is what I would have expected).

Take a look at the example, and if you have any questions or want to clarify what you are seeing, I'll take a second look at it.

Thanks,
0 Kudos
Message 2 of 5
(6,078 Views)
I tried that, and that itself worked. But what I'm trying to do is take a decimal string, convert it to a floating point number, THEN send it to Excel. I think the problem lies in the conversion, since the limit (due to Windows) is 2^31. What I'd like to do is to send the value of the string to the Excel worksheet. Hope this helps.
0 Kudos
Message 3 of 5
(6,078 Views)
It sounds like at some point in your conversion, you're trying to create an integer.
Windows does not have a limitation of 2^31 for floating point numbers. Windows does use 32 bit integers, so the largest unsigned integer is (2^32)-1.
Windows and LabVIew support IEEE 32 bit (single precision) and IEEE 64 bit (double precision) floating point numbers. In IEEE single precision floating point, there are 8 bits for the exponent. The max exponent ((2^8) - 1 = 255) is reserved for Not A Number or +/- infinity. The max exponent for real numbers is 254. In IEEE double precision floating point, there are 11 bits for the exponent. The max exponent is ((2^11)-1 = 2047) is reserved for Not A Number or +/- infinity. The max exponent for real numbers is 2
046.
These floating point numbers are obviously much larger than 2^31.
0 Kudos
Message 4 of 5
(6,078 Views)
OK, I went ahead and found a solution. The answer lies in the "Write to Spreadsheet file.vi". What I did was change the single floating-point values to strings and then changed the format to accept strings. The program worked beautifully after that.

Thanks for all your help!
0 Kudos
Message 5 of 5
(6,078 Views)