Closed valexey closed 11 years ago
We should use integer conversion in all arithmetics operations (with integer numbers). Example:
MODULE Test; IMPORT JS; PROCEDURE Do*; VAR x: INTEGER; BEGIN x:=07FFFFFFFH + 1; x:=0FFFFFFFFH * 2; END Do; BEGIN Do END Test.
Now compiles to:
var Test = function (JS){ function Do(){ var x = 0; x = 2147483647 + 1; x = 4294967295 * 2; } Do(); return { Do: Do } }(this);
But correct is:
var Test = function (JS){ function Do(){ var x = 0; x = (2147483647 + 1) | 0; x = (4294967295 * 2) | 0; } Do(); return { Do: Do } }(this);
We should use integer conversion in all arithmetics operations (with integer numbers). Example:
Now compiles to:
But correct is: