27.02.2012, 14:50
Does the % operator get affected by integer / variable overflows?
I mean look at this..
with:
If it affects pawn it does C++ too.. or am I wrong?
Also I think == is faster than %.. (I know it's not really a big deal but anyway..)
I mean look at this..
Код:
[16:51:04] 2147483630 1 [16:51:04] 2147483631 0 [16:51:04] 2147483632 0 [16:51:04] 2147483633 0 [16:51:04] 2147483634 0 [16:51:04] 2147483635 0 [16:51:04] 2147483636 0 [16:51:04] 2147483637 0 [16:51:04] 2147483638 0 [16:51:04] 2147483639 0 [16:51:04] 2147483640 1 [16:51:04] 2147483641 0//1 [16:51:04] 2147483642 0//2 [16:51:04] 2147483643 0//... [16:51:04] 2147483644 0 [16:51:04] 2147483645 0 [16:51:04] 2147483646 0 [16:51:04] 2147483647 0 [16:51:04] -- 0//WTF? [16:51:04] -2147483647 0 [16:51:04] -2147483646 0 [16:51:04] -2147483645 0 [16:51:04] -2147483644 0 [16:51:04] -2147483643 0 [16:51:04] -2147483642 0 [16:51:04] -2147483641 0//15 instead of 10 [16:51:04] -2147483640 1 [16:51:04] -2147483639 0 [16:51:04] -2147483638 0 [16:51:04] -2147483637 0 [16:51:04] -2147483636 0 [16:51:04] -2147483635 0 [16:51:04] -2147483634 0 [16:51:04] -2147483633 0 [16:51:04] -2147483632 0 [16:51:04] -2147483631 0 [16:51:04] -2147483630 1 [16:51:04] -2147483629 0 [16:51:04] -2147483628 0 [16:51:04] -2147483627 0 [16:51:04] -2147483626 0 [16:51:04] -2147483625 0 [16:51:04] -2147483624 0 [16:51:04] -2147483623 0 [16:51:04] -2147483622 0 [16:51:04] -2147483621 0 [16:51:04] -2147483620 1 [16:51:04] -2147483619 0 [16:51:04] -2147483618 0 [16:51:04] -2147483617 0 [16:51:04] -2147483616 0 [16:51:04] -2147483615 0 [16:51:04] -2147483614 0 [16:51:04] -2147483613 0 [16:51:04] -2147483612 0 [16:51:04] -2147483611 0 [16:51:04] -2147483610 1 [16:51:04] -2147483609 0 [16:51:04] -2147483608 0 [16:51:04] -2147483607 0 [16:51:04] -2147483606 0 [16:51:04] -2147483605 0 [16:51:04] -2147483604 0 [16:51:04] -2147483603 0 [16:51:04] -2147483602 0 [16:51:04] -2147483601 0 [16:51:04] -2147483600 1 [16:51:04] -2147483599 0 [16:51:04] -2147483598 0 [16:51:04] -2147483597 0 [16:51:04] -2147483596 0 [16:51:04] -2147483595 0 [16:51:04] -2147483594 0 [16:51:04] -2147483593 0 [16:51:04] -2147483592 0 [16:51:04] -2147483591 0 [16:51:04] -2147483590 1 [16:51:04] -2147483589 0 [16:51:04] -2147483588 0 [16:51:04] -2147483587 0 [16:51:04] -2147483586 0 [16:51:04] -2147483585 0 [16:51:04] -2147483584 0 [16:51:04] -2147483583 0 [16:51:04] -2147483582 0 [16:51:04] -2147483581 0 [16:51:04] -2147483580 1 [16:51:04] -2147483579 0 [16:51:04] -2147483578 0 [16:51:04] -2147483577 0 [16:51:04] -2147483576 0 [16:51:04] -2147483575 0 [16:51:04] -2147483574 0 [16:51:04] -2147483573 0 [16:51:04] -2147483572 0 [16:51:04] -2147483571 0 [16:51:04] -2147483570 1 [16:51:04] -2147483569 0 [16:51:04] -2147483568 0 [16:51:04] -2147483567 0
pawn Код:
for (new i = 0; i < 100; i++)
printf("%d %b", 2147483630 + i, ((2147483630 + i) % 10) ==0);
Also I think == is faster than %.. (I know it's not really a big deal but anyway..)