procedure ShowBinaryRepresentation;
var
S, S2: Single;
I: Integer;
D, D2: Double;
I64: Int64;
begin
S := -1.841;
I := PInteger(@S)^;
OutputWriteLine(Format('Single in binary represenation: %.8X', [I]));
S2 := PSingle(@I)^;
OutputWriteLine(Format('Converted back to single: %f', [S2]));
D := -1.841E50;
I64 := PInt64(@D)^;
OutputWriteLine(Format('Double in binary represenation: %.16X', [I64]));
D2 := PDouble(@I64)^;
OutputWriteLine(Format('Converted back to double: %f', [D2]));
end;
Run Code Online (Sandbox Code Playgroud)
单个二进制表示:BFEBA5E3 转换回单身:-1,84 双二进制表示:CA5F7DD860D57D4D 转换回双精度:-1,841E50
归档时间: |
|
查看次数: |
8377 次 |
最近记录: |