10-01-2013 12:56 PM
Hi all,
I'm having trouble converting an EXT to a U64.
I searched the forum and found this excellent post for going the other way: converting a U64 to an EXT. This solved half my problem beautifully.
Unfortunately, I need to be able to go the other way also and I'm having trouble ascertaining how by looking at this code. I understand parts of it, but not the whole. I haven't been successful in finding a conversion algorithm online (normally Mr. Google is more helpful than he was today).
Typecasting the EXT to a U64 doesn't give me accurate results (also discussed elsewhere on the forum, this is a lossy conversion). Using the "to U64" function on the numeric conversion palette also does not give me accurate results. I checked both of these things by inputting a U64 to the code shown in the link above, then taking the resulting EXT and attempting to convert it back to a U64 using either the numeric conversion function or a typecast.
This post discusses the issue with the numeric conversion function:
It's wonderful that this was resolved in LV 2013, but I'm using LV 2012.
I think I need to figure out how to reverse the code I linked to above, but I don't understand it well enough to do so. Can anyone help?
Thanks!
Diane
10-02-2013 06:05 PM
Hi Diane,
I have looked through the Bug report, but there was no mention of the workaround or fix documentation that was implemented in the 2013 version, so we'll have to find a workaround.
Since this conversion issue only arises when the top 53 bits are set, I suggest starting up by checking your initial EXT. If those bits are set (you could do a conversion to string and compare the first 13 characters to FFFFFFFFFFFFF), then this is where the tricky bug comes in; if not it appears typecasting to U64 works out.
In the problematic case, a possible idea (that looks similar yet a little simpler to the VI you mentioned) would be to convert the EXT to a string, split the string in two, convert those separatly, concatenate the strings and convert back to a U64.
10-03-2013 01:48 PM
That's a thought. Thanks Xavier! I'll let you know how it goes.
Thanks for responding!
Diane