level 1
缘来远去16
楼主
function tofloat(a,b,c,d:integer):double;
var
M,E,k:int64;
i:integer;
t_tofloat:double;
begin
【计算公式:浮点数值=(+/-)(1+M/8388608)*(2^(E-127))】
M:=(b and 127)*65536+c*256+d;
E:=(((a*256+b)and 32640) shr 7)-127;
k:=1;
for i:=1 to E do
k:=2*k;
t_tofloat:=(1+M/8388608)*k;
if (a and 128)=128 then
t_tofloat:=-1*t_tofloat;
tofloat:= t_tofloat;
end;
2016年10月11日 13点10分
1
var
M,E,k:int64;
i:integer;
t_tofloat:double;
begin
【计算公式:浮点数值=(+/-)(1+M/8388608)*(2^(E-127))】
M:=(b and 127)*65536+c*256+d;
E:=(((a*256+b)and 32640) shr 7)-127;
k:=1;
for i:=1 to E do
k:=2*k;
t_tofloat:=(1+M/8388608)*k;
if (a and 128)=128 then
t_tofloat:=-1*t_tofloat;
tofloat:= t_tofloat;
end;