HexStringtoNumber Conversion

Good day!

I would like to ask what would be the possible problem in the HexStringtoNumber conversion because when I converted the hexadecimal data to numeric value, the value was not the same when I compared it to the conversion I received using the calculator. Like in index 40 of “F1_sDLMS_values” tab, it should be of the same value with the numeric data in index 40 of “F1_nDLMS_Values64” tab but it’s not when I checked it using the calculator as seen on the images below.

Welcome to the forums Arnel.

Lets page @philip and @torchard to this one… I am shaky when it comes to IEEE floats and stuff.

You typed a different value in the calculator than what is shown in the tag.


Hmmm, I typed the one from the table on the right and it was a different HEX result than the one on the left.
I did not even think to look at his calc screenshots.

Sorry about the confusion, what I’m trying to say is that the hexstring value in F1_sDLMS_values[40]/B99906ED should give me an integer value of “3,113,813,741” when I use HexStringToNumber command, instead it gives me F1_sDLMS_values64[40]/"-1181153555".
All other indexes give me the right value except for 40, 41, 43 & 44.

Is there anything that I did wrong or am I using the wrong command?

No, you are using it correctly. All integers in PAC Control are signed and the HexStringToNumber is only for 32 bit integers. Any values above 2,147,483,647 will show up as negative numbers.

To get around this, you should run the HexStringToNumber into a temporary variable and then use the MakeInt64 command to move the temporary value into a 64 bit integer:

nTemp64 = MakeInt64(0, nTemp);

This will get you the value you are looking for.


Thank you very much Sir Philip for this suggestion, it really solved my problem.

Thanks a lot!