S shiran Unregistered / Unconfirmed GUEST, unregistred user! 2002-08-06 #1 我如何可以将65,63,30,184这样一个BYTE的数组何在一起转换成一个浮点数?
L linsb Unregistered / Unconfirmed GUEST, unregistred user! 2002-08-06 #4 var str:string; Num:array[1..4] of byte; realNum:reeal; ..... Num[1]:=65; ... str:=''; for i:=1 to 4 do str:=str+IntToStr(Num); realNum:=StrToFloat(str);
var str:string; Num:array[1..4] of byte; realNum:reeal; ..... Num[1]:=65; ... str:=''; for i:=1 to 4 do str:=str+IntToStr(Num); realNum:=StrToFloat(str);
C Crane Unregistered / Unconfirmed GUEST, unregistred user! 2002-08-06 #5 先两两转成WORD再用API的宏(不知delphi有否) MAKELONG( WORD wLow, WORD wHigh ); 强制转成real,试试吧。
U ugvanxk Unregistered / Unconfirmed GUEST, unregistred user! 2002-08-06 #6 a:array[0..4]of byte; b:flaot; move(a,b,4);
L LeeChange Unregistered / Unconfirmed GUEST, unregistred user! 2002-08-06 #7 var a: array[1..4] of Byte; b: single absolute a; begin a[1]:=65; a[2]:=63; a[3]:=30; a[4]:=184; ShowMessage(FloatToStr(b)) end;
var a: array[1..4] of Byte; b: single absolute a; begin a[1]:=65; a[2]:=63; a[3]:=30; a[4]:=184; ShowMessage(FloatToStr(b)) end;
M Milpas Unregistered / Unconfirmed GUEST, unregistred user! 2002-08-06 #8 var bb: array[0..3] of Byte = (65,63,30,184); ff: real; i: Integer; ff := bb[0]; for i := 1 to 3 do begin ff := ff shl 8; ff := ff + bb end; ShowMessage(FloatToStr(ff));
var bb: array[0..3] of Byte = (65,63,30,184); ff: real; i: Integer; ff := bb[0]; for i := 1 to 3 do begin ff := ff shl 8; ff := ff + bb end; ShowMessage(FloatToStr(ff));