一浮点数用十六进制四字节表示,如何将其转化为十进制数:
如0X44A56E8,转化成功后为:1323.456
C语言可以自动转化,难道delphi得自己写算法?

解决方案 »

  1.   

    对头,你答对了,不加分.Delphi没有16进制的说法。得自己慢慢算。
      

  2.   

    十六进制转为10进制浮点数是可以用StrToFloat函数的,不过你举的例子是不是有问题
      

  3.   

    没有人回答我自己回答吧,分我自己得了,目的在于共享心得
    var
    tempDouble:Single;
    tempbyte: array[0..3] of Byte;
    i:Integer;
    begin
    // tempDouble:=0.00;
      tempbyte[0]:=StrtoInt('$98');
      tempbyte[1]:=StrtoInt('$6E');
      tempbyte[2]:=StrtoInt('$A5');
      tempbyte[3]:=StrtoInt('$44');
      CopyMemory(@tempDouble,@tempbyte, 4);  //将字节数组转为Double型变量
      label1.Caption:=floattostr(tempdouble);  // 往返过程   CopyMemory(@tempbyte, @tempDouble, 4);  //将Double型变量转为字节数组
            For i:= 0 To High(tempByte) do
            label1.caption:=label1.caption+InttoHex(tempByte[i],0);
      end;