Problem with integers and gettings percentages from them
#3

PHP код:
newBank = ((Player[playerid][pBank] / 100) * (100 BANK_DEFAULT_INTEREST)); 
As Vince said int*/+-int equals int, a simple add of .0 can turn those constants to float, resulting in a float division, also I would like to keep all the calculation of constants together (as far as I know, they get compiled as 1 number if they are all constants) so
PHP код:
        new Bank = ((Player[playerid][pBank]) * (1.0+(BANK_DEFAULT_INTEREST/100.0)); 
Is actually quite better IMO (Although all of it should be under floatround.)
Reply


Messages In This Thread
Problem with integers and gettings percentages from them - by Josh_Lotus - 09.01.2016, 15:50
Re: Problem with integers and gettings percentages from them - by Vince - 09.01.2016, 17:04
Re: Problem with integers and gettings percentages from them - by PrO.GameR - 09.01.2016, 21:40
Re: Problem with integers and gettings percentages from them - by Josh_Lotus - 09.01.2016, 23:07

Forum Jump:


Users browsing this thread: 1 Guest(s)