Registriert seit: 20. Jan 2006
Ort: Lübbecke
11.475 Beiträge
Delphi 12 Athens
|
AW: 80 bit IEEE Standard 754 floating point number
29. Jul 2022, 13:31
Delphi-Quellcode:
function Convert(Bytes: TBytes): Extended;
var
exponent: Word;
mantissa: UInt64;
signBit: Boolean;
begin
signBit := (bytes[0] and $80) <> 0;
WordRec(exponent).Hi := Bytes[0] and $7F;
WordRec(exponent).Lo := Bytes[1];
for var I := 0 to 7 do
Int64Rec(mantissa).Bytes[I] := Bytes[9 - I];
Result.BuildUp(signbit, mantissa, Integer(exponent) - 16383);
end;
|