gm2
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Overflow in 2nd argument in DEC procedure


From: Runar Tenfjord
Subject: Overflow in 2nd argument in DEC procedure
Date: Fri, 4 Nov 2022 23:18:59 +0100

The following program create different results due to silent
overflow in the 2nd argument in the DEC procedure:

MODULE test;
FROM libc IMPORT printf;

VAR
    bigval : LONGCARD;
    smallval : CARDINAL;
BEGIN
    bigval := 5184000000;
    smallval := 60;
    DEC(bigval, 86400000 * smallval);
    printf('d1 = %llu\n', bigval);
    bigval := 5184000000;
    DEC(bigval, 86400000 * 60);
    printf('d2 = %llu\n', bigval);
END test.

Is this expected behavior?

Best regards
Runar Tenfjord

reply via email to

[Prev in Thread] Current Thread [Next in Thread]