And my run of bugs continues: https://quality.embarcadero.com/browse/RSP-20351
And my run of bugs continues: https://quality.embarcadero.com/browse/RSP-20351
This program:
{$APPTYPE CONSOLE}
var
D: Double;
U64: UInt64;
begin
D := high(UInt64);
Writeln(D);
U64 := high(UInt64);
D := U64;
Writeln(D);
Readln;
end.
should output
1.84467440737096E+0019
1.84467440737096E+0019
but in fact outputs
-1.00000000000000E+0000
1.84467440737096E+0019
I guess the compiler generates code as if the constant value was treated as a signed Int64.
Shout out to Stefan Glienke for bringing this one to my attention.
I have one more bug that I have seen, but not yet submitted.
Quite amazing what can be found with a little bit of effort. Imagine if the Emba team put in some serious testing effort?
https://quality.embarcadero.com/browse/RSP-20351
This program:
{$APPTYPE CONSOLE}
var
D: Double;
U64: UInt64;
begin
D := high(UInt64);
Writeln(D);
U64 := high(UInt64);
D := U64;
Writeln(D);
Readln;
end.
should output
1.84467440737096E+0019
1.84467440737096E+0019
but in fact outputs
-1.00000000000000E+0000
1.84467440737096E+0019
I guess the compiler generates code as if the constant value was treated as a signed Int64.
Shout out to Stefan Glienke for bringing this one to my attention.
I have one more bug that I have seen, but not yet submitted.
Quite amazing what can be found with a little bit of effort. Imagine if the Emba team put in some serious testing effort?
https://quality.embarcadero.com/browse/RSP-20351
Sorry.. As both, Double and Int64, are 8 bits, so I deduced that the truncated value of whatever Double will within the Int64 range..
ReplyDeleteRafael Dipold The maximum double value is about 2E+289 times larger than the maximum Int64 value even though they both occupy 8 bytes.
ReplyDeleteAnd in the other direction, when assigning an Int64 to double, double only has 53 bit mantissa so for large values you lose precision.
ReplyDelete