Rounding off integer.
#1

How can I round of an integer to 3 decimal places if it has 6 .
Reply
#2

hmm maybe there will be a function in pawn like setprecise of iomanip library in c++
Reply
#3

Quote:
Originally Posted by AroseKhanNiazi
Посмотреть сообщение
How can I round of an integer to 3 decimal places if it has 6 .
An integer cannot have decimals. You're talking about a float and in that case you would have to use regex and take the decimal you want, round it off and add everything up to a float again.
Reply
#4

Sorry my bad 3 whole number place; anyway isn't this code right to get mili seconds?
pawn Код:
pMili[playerid]=GetTickCount(); // this is when race started..
pMili[playerid]=(((GetTickCount()-pMili[playerid])-(1000*pSec[playerid]))-((1000*60)*pMin[playerid]));
should give me 3 digits and should work but it gives me some random numbers mostly more than 3.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)