Netjs icon indicating copy to clipboard operation
Netjs copied to clipboard

Integer casts do not truncate

Open praeclarum opened this issue 10 years ago • 1 comments

The code:

int i = (int)3.14;

produces:

i = <number>3.14;

The truncation is lost.

praeclarum avatar Mar 31 '14 18:03 praeclarum

same problem affects integer division: int x = 502; x = x / 100;

produces i = 5.02

those conversions (and result of division) should be treated with x >> 0 to get the integer value

kskalski avatar Mar 26 '15 07:03 kskalski