2020-12-22, 10:32 AM
Hi guys
I use percentage for many things in my SA-MP server.(discounts,tax etc),but I have some problems with it.
For "small" numbers it work pretty nice.
Code:
First test:
PERCENT: 75
PRICE: 140 000 000
Result:?19100654
Result is ok
Second test:
PERCENT: 75
PRICE: 340 000 000
Result:?-17698038
Result is wrong
Does anyone have idea how I should fix it?
I use percentage for many things in my SA-MP server.(discounts,tax etc),but I have some problems with it.
For "small" numbers it work pretty nice.
Code:
Code:
new result = PERCENT*PRICE/100;
printf("Result: %d",result);
First test:
PERCENT: 75
PRICE: 140 000 000
Result:?19100654
Result is ok
Second test:
PERCENT: 75
PRICE: 340 000 000
Result:?-17698038
Result is wrong
Does anyone have idea how I should fix it?