I need to convert a string HEX
to decimal
, string
uses the default Complement of Two and IEEE-754
to set the number of decimal places
It is a tracking system, according to the manual a string
C1B6DF66
corresponds to -22,8590813
and C23C1762
corresponds to -47,0228348
.
var fb = Convert.ToUInt32(hx,16);
var twosComp2 = (~fb + 1);
var y= BitConverter.ToSingle(BitConverter.GetBytes((int)twosComp2), 0);
I'm using the above code but I can not get the same result.