grendelJS
asked on
float IEEE 754 to hex
Hi,
I need to convert a float (IEEE 754) to hexdecimal.
Is there a class that do it in C#?
I need to convert a float (IEEE 754) to hexdecimal.
Is there a class that do it in C#?
Are you asking how to get the 4 hex bytes that make up the float?
If so, try BitConverter.GetBytes()
If so, try BitConverter.GetBytes()
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.
I'am sorry but I'm not sure about the steps I need to do to get the second number.
ASKER
I've got the solution. A friend of mine, have suggested it.
float a = 11.0F;
uint myUint = BitConverter.ToUInt32(BitC onverter.G etBytes(a) ,0);
float a = 11.0F;
uint myUint = BitConverter.ToUInt32(BitC
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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