12-10-2022 08:10 AM
Hi all, i have this problem, i try to convert decimal number to exadecimal, concatenate with other exadecimal and reconvert on decimal but don't work.
the result number is not correct, where i wrong
12-10-2022 10:26 AM - edited 12-10-2022 12:16 PM
If you really want to merge two 32bit integers, the constant wired to typecast should be 64bit, right? Did you notice the coercion dot?
Typecast is a very dangerous function for the newbie. There is no error handling and given incorrect inputs can give you completely meaningless outputs. You need to make absolutely sure that the inputs match the output type down to the bit. In your case, you tried to cast a 8byte hex string to a 4 byte numeric. Round peg, square hole!
12-10-2022 10:42 AM
@Simx7719 wrote:
i try to convert decimal number to exadecimal, concatenate with other exadecimal and reconvert on decimal but don't work.
I've never heard of an "exadecimal" number, nor has Google (which told me about "hexadecimal", which I do know about). Unfortunately, I do not have LabVIEW 2022 installed on any of my PCs, so I'm going to proceed assuming that @Smix meant "hexadecimal".
LabVIEW has two functions on the Data Manipulation sub-Palette of the Numeric Palette that can Split Numbers (integers, from 16, 32, or 64 bits) into unsigned integers of 8, 16, or 32 bits (you can technically ask it to split an 8-bit number, which it treats as a 16-bit number with the top 8 bits all zero). Similarly, there is also Join Numbers.
The important thing to realize is how signed integers are represented (in LabVIEW and most computers). Consider (say) a 16-bit number, let's say +6. In decimal, it is 6 (leading zeros are "silent"), and in hex it is 0x0006. What about -6? Signed integers use the most-significant bit as a "sign" bit, set to 1 if the number is negative, with the additional "rule" that a number and its negative add to 0. If you work it out, you can find that -6 is 0xFFFA (or 0b1111111111111010). [Try doing the arithmetic in binary, recalling +6 is 0000000000000110 --adding from right to left, 0+0 = 0, 1 + 1 = 0 carry 1, 0 + 1 + carry = 0, 1 + 0 + carry = 0 + carry, 1 + 0 + carry = 0 + carry, until you end with all zeros and a "left-over" carry (which you throw away), showing 6 + (-6) = 0. So you need to be aware of this and think about it when dealing with signed quantities.
I suggest writting a little VI for yourself that lets you enter a 16-bit number as a signed integer (I16), wire it to an U16 indicator (to see how the sign bit works -- display it both in Hex and Decimal), then try splitting it and viewing the splits. Once you understand Splits, work on Joins, and before you know it, you'll realize how to do what you want to do.
Bob Schor
12-10-2022 10:53 AM
thank you very much i understood my many mistakes, i understood what to go to study well THANK YOU!!!
12-10-2022 08:28 PM - edited 12-10-2022 08:30 PM
Just for the fun of it, hexadecimal is actually a macaronic word, it consists of the Greek hexa and the Latin decim. The pure latin version would be sexadecimal but that dtd likely not make it because of its to close resemblance with sex.
12-11-2022 02:01 AM
@rolfk wrote:
Just for the fun of it, hexadecimal is actually a macaronic word, it consists of the Greek hexa and the Latin decim. The pure latin version would be sexadecimal but that dtd likely not make it because of its to close resemblance with sex.
As if numbers aren't sexy enough...
12-11-2022 09:25 AM
... and GPS made "sextants" obsolete. 😄
12-11-2022 05:10 PM
@rolfk wrote:
Just for the fun of it, hexadecimal is actually a macaronic word, it consists of the Greek hexa and the Latin decim. The pure latin version would be sexadecimal but that dtd likely not make it because of its to close resemblance with sex.
I don't think that's the reason, because we refer base 60 (for times and angles) as sexagesimal.
12-11-2022 05:13 PM - edited 12-11-2022 05:14 PM
@paul_cardinale wrote:
@rolfk wrote:
Just for the fun of it, hexadecimal is actually a macaronic word, it consists of the Greek hexa and the Latin decim. The pure latin version would be sexadecimal but that dtd likely not make it because of its to close resemblance with sex.
I don't think that's the reason, because we refer base 60 (for times and angles) as sexagesimal.
But it's a purely academic system. I have never seen anyone really use it in any way. And with 60 different symbols to come up with it looks a bit Chinese to me. 😁 More than 16 starts to get a bit difficult to learn and manage.
12-11-2022 05:16 PM
@Simx7719 wrote:
Hi all, i have this problem, i try to convert decimal number to exadecimal, concatenate with other exadecimal and reconvert on decimal but don't work.
the result number is not correct, where i wrong
"Exa" means 10^18. So I guess "exadecimal" would be base quintillion and ten (i.e. 1,000,000,000,000,000,010). Converting to "exadecimal" would certainly be very ambitious, but I'm afraid even Unicode won't help you.