I am converting some old Pascal to JavaScript. I need some two 32-bit integers.
In the following loop example, some multiplications will cause overflow and will give negative numbers. This is intentional. I need to reproduce the same final number x at the end that matches the old system.
How can I do this in JavaScript to achieve the same result?
Here is a sample code:
var x = new Number(some value); // I need this to be a 32-bit signed integer var y = new Number(some value); // I need this to be a 32-bit signed integer for (var i=0; i<100; i++) { x = x * y; } return x;
javascript
Vic
source share