LINUX.ORG.RU

История изменений

Исправление saahriktu, (текущая версия) :

program int64overflowtest;
var
        x: Int64;
begin
        x := 99999999999 * 999999999;
        writeln(x);
end.
Compiling int64overflowtest.pas
int64overflowtest.pas(5,19) Error: Overflow in arithmetic operation
int64overflowtest.pas(8) Fatal: There were 1 errors compiling module, stopping
Fatal: Compilation aborted

===

program int64overflowtest;
var
        x: Int64;
begin
        x := 9223372036854775807 + 1;
        writeln(x);
end.
Compiling int64overflowtest.pas
int64overflowtest.pas(5,27) Warning: range check error while evaluating constants (9223372036854775808 must be between -9223372036854775808 and 9223372036854775807)
Linking int64overflowtest
$ ./int64overflowtest
-9223372036854775808
===
program int64overflowtest;
var
        x, y: Int64;
begin
        x := 99999999999;
        y := 999999999;
        x := x * y;
        writeln(x);
end.
Compiling int64overflowtest.pas
Linking int64overflowtest
$ ./int64overflowtest
7766279530452241921

Исходная версия saahriktu, :

program int64overflowtest;
var
        x: Int64;
begin
        x := 99999999999 * 999999999;
        writeln(x);
end.
Compiling int64overflowtest.pas
int64overflowtest.pas(5,19) Error: Overflow in arithmetic operation
int64overflowtest.pas(8) Fatal: There were 1 errors compiling module, stopping
Fatal: Compilation aborted

===

program int64overflowtest;
var
        x: Int64;
begin
        x := 9223372036854775807 + 1;
        writeln(x);
end.
Compiling int64overflowtest.pas
int64overflowtest.pas(5,27) Warning: range check error while evaluating constants (9223372036854775808 must be between -9223372036854775808 and 9223372036854775807)
Linking int64overflowtest
$ ./int64overflowtest
-9223372036854775808