Math with floats and integers
#6

You dont need floatround, integer multiplication is enough
But if you only use integer you always should multiply first
pawn Код:
new
    bizTax = gStats[govPercentageBiz],
    currentBizPrice = eStats[i][bizPrice]
;
currentBizPrice = (currentBizPrice * bizTax) / 100; // or just without brackets
Even if you wanted to use floats the correct way would be
pawn Код:
new
    bizTax = gStats[govPercentageBiz],
    currentBizPrice = eStats[i][bizPrice]
;
currentBizPrice = floatround((currentBizPrice * (bizTax / 100.0))); // notice the .0, otherwise it's just a integer division
Reply


Messages In This Thread
Math with floats and integers - by Hansrutger - 25.12.2013, 17:48
Re: Math with floats and integers - by Konstantinos - 25.12.2013, 17:58
Re: Math with floats and integers - by Hansrutger - 25.12.2013, 18:35
Re: Math with floats and integers - by Konstantinos - 25.12.2013, 18:40
Re : Math with floats and integers - by [HRD]Mar1 - 25.12.2013, 18:41
AW: Math with floats and integers - by Nero_3D - 25.12.2013, 18:49

Forum Jump:


Users browsing this thread: 2 Guest(s)