Hi,
I need to convert a float (IEEE 754) to hexdecimal.
Is there a class that do it in C#?
C#
Last Comment
CetusMOD
8/22/2022 - Mon
smegghead
Use...
string Res=Convert.ToString(754,16);
the 2nd parameter (16) represents the base.
HTH
Smg.
PS. to convert back to decimal (from hex) - use...
int Res=int.Parse(InHex,NumberStyles.HexNumber)
ericgu
Are you asking how to get the 4 hex bytes that make up the float?
If so, try BitConverter.GetBytes()
grendelJS
ASKER
I'am trying to convert a floating point value (following the IEEE standard 754) 11.0 to this number: 1093664768.
I'am sorry but I'm not sure about the steps I need to do to get the second number.
string Res=Convert.ToString(754,1
the 2nd parameter (16) represents the base.
HTH
Smg.
PS. to convert back to decimal (from hex) - use...
int Res=int.Parse(InHex,Number