IEEE 754 c#中的转换
Code
//ffloat转换成hex
float num1 = 999999f;
// Convert to IEEE 754
uint num2 = BitConverter.ToUInt32(BitConverter.GetBytes(num1), 0);
//hex转换成float
// Hex representation
byte[] byteArray = BitConverter.GetBytes(num1);
Array.Reverse(byteArray);
// Convert back to float
float num3 = BitConverter.ToSingle(BitConverter.GetBytes(num2), 0);
//ffloat转换成hex
float num1 = 999999f;
// Convert to IEEE 754
uint num2 = BitConverter.ToUInt32(BitConverter.GetBytes(num1), 0);
//hex转换成float
// Hex representation
byte[] byteArray = BitConverter.GetBytes(num1);
Array.Reverse(byteArray);
// Convert back to float
float num3 = BitConverter.ToSingle(BitConverter.GetBytes(num2), 0);