Wrong calculation negative integer values with DIV
Original Reporter info from Mantis: ps
-
Reporter name: Pavol S
Original Reporter info from Mantis: ps
- Reporter name: Pavol S
Description:
Pascal:
Writeln(-1 div 12);
0
Pas2JS:
Writeln(-1 div 12);
-1
Compiled into JS: Math.floor(-1 / 12). Bug is visible in SysUtils procedure IncAMonth with negative month values.
Maybe compiled into JS: Math.round(-1/12); will be better?
Mantis conversion info:
- Mantis ID: 37392