type
ar24bit = array of byte;
function ToFloat (b1:byte;b2:byte;b3:byte):extended;
var i1:int64;
var retval,Q:extended;
var ar : array[0..2] of byte;
begin
ar[0] := b1;
ar[1] := b2;
ar[2] := b3;
i1 := 0;
move ( ar, i1, 3);
i1 := (i1 and $7fffff) - (i1 and $800000);
retval := i1 /8388608;
result := retval;
end;
function ConvertToByte(fl:extended):ar24bit;
var ret1,ret2,ret3,ret4:longint;
var retf:double;
var ar : ar24bit;
var retf2 : double;
var ar2 : array[0..2] of byte;
begin
retf := fl * 8388608 ;
ret1 := round(retf);
if (ret1 and $80000000) <> 0 then
begin
ret1 := ret1 or $00800000;
end;
setlength(ar,0);
setlength(ar,3);
Move(ret1, ar2, 3);
ar[0] := ar2[0];
ar[1] := ar2[1];
ar[2] := ar2[2];
result := ar;
end;