RosettaCodeData/Task/Integer-overflow/Seed7/integer-overflow.seed7

20 lines
532 B
Plaintext

$ include "seed7_05.s7i";
const proc: writeResult (ref func integer: expression) is func
begin
block
writeln(expression);
exception
catch OVERFLOW_ERROR: writeln("OVERFLOW_ERROR");
end block;
end func;
const proc: main is func
begin
writeResult(-(-9223372036854775807-1));
writeResult(5000000000000000000+5000000000000000000);
writeResult(-9223372036854775807 - 9223372036854775807);
writeResult(3037000500 * 3037000500);
writeResult((-9223372036854775807-1) div -1);
end func;