I
iie
Unregistered / Unconfirmed
GUEST, unregistred user!
我简单测试了一下,不用power函数也可以,样例附下.
另外,如果能改源码的话,blockwrite可以实现
你甚至可以这样转换:
blockread(fin, areal, 6);
blockwrite(fout, adouble, 8);
var areal: real;
adouble:do
uble;
aarray: array [1..6] of byte absolute areal;
alongint: longint;
abyte: byte;
aboolean: boolean;
i: integer;
temp: integer;
begin
areal := strtofloat(edit1.text);
abyte := aarray[1];
alongint := 0;
aboolean := aarray[6] and $80 <> 0;
aarray[6] := aarray[6] and $7f;
adouble := 0;
for i := 6do
wnto 2do
begin
adouble := adouble * 256;
adouble := adouble + aarray;
end;
adouble := adouble / 256/256/256/256/128 + 1;
if abyte = 0 then
adouble := 0
else
adouble := exp((abyte - 129) * ln(2)) * adouble;
if aboolean then
adouble := -adouble;
edit2.text := floattostrf(adouble, ffFixed, 6, 3);
end;
另外,如果能改源码的话,blockwrite可以实现
你甚至可以这样转换:
blockread(fin, areal, 6);
blockwrite(fout, adouble, 8);
var areal: real;
adouble:do
uble;
aarray: array [1..6] of byte absolute areal;
alongint: longint;
abyte: byte;
aboolean: boolean;
i: integer;
temp: integer;
begin
areal := strtofloat(edit1.text);
abyte := aarray[1];
alongint := 0;
aboolean := aarray[6] and $80 <> 0;
aarray[6] := aarray[6] and $7f;
adouble := 0;
for i := 6do
wnto 2do
begin
adouble := adouble * 256;
adouble := adouble + aarray;
end;
adouble := adouble / 256/256/256/256/128 + 1;
if abyte = 0 then
adouble := 0
else
adouble := exp((abyte - 129) * ln(2)) * adouble;
if aboolean then
adouble := -adouble;
edit2.text := floattostrf(adouble, ffFixed, 6, 3);
end;