Home > Back-end >  Floating-point hexadecimal 4 bytes
Floating-point hexadecimal 4 bytes

Time:10-07

In Delphi, how to switch the floating-point 4 bytes hexadecimal

CodePudding user response:

To ask, you can put guarantee 4 bytes of floating-point (8 bytes)?

CodePudding user response:

Single precision not only 4 bytes, double precision is 8 bytes?

CodePudding user response:

Var
B: array [0.. 3] of Byte;
N: Single;
The begin
N:=1283123.12;
PSingle (@ n) ^ :=n;//has turned for the better, directly into the
Or ShowMessage (IntToHex (PInteger ^ @ n, 8));//this also, achieve mastery through a comprehensive study to
end;

CodePudding user response:

PSingle ^ @ B) :=n;

CodePudding user response:

4 bytes, each word $00 ~ $FF, Result:=format (' %. 8 x '[floor (f)));

CodePudding user response:

Type
TSingleRec=record
In case the Integer of
Value: 0: (Single);
1: (bLL, bLH, bHL bHH: Byte);
end;

Var
FSingleRec: TSingleRec;
STRTP: string;
The begin
FSingleRec. Value:=1323.535;
STRTP:=
Inttohex (fSingleRec. BLL, 2) + +
'Inttohex (fSingleRec bLH, 2) + +
'Inttohex (fSingleRec bHL, 2) + +
'Inttohex (fSingleRec. BHH, 2) + ";

CodePudding user response:

But figures more than words or lost a lot,
  • Related