首Html代码

学有所用,不然就失去意义。

子标题

导航

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);


posted on 2009-02-16 13:03  tssing  阅读(3691)  评论(1编辑  收藏  举报

页脚Html代码