SA-MP Forums Archive
round a float val to certain value - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: round a float val to certain value (/showthread.php?tid=154614)



round a float val to certain value - Trooper[Y] - 14.06.2010

Hey together.

First of all, im not seeking for floatround.
I want to round this float:
Код:
x.0000
to
Код:
x.0
Im sad, that the wiki nearly have nothing about float-actions...


Re: round a float val to certain value - Tr1viUm - 14.06.2010

If you're interested in using that in format. Use %.1f where 1 is the amount of decimals.

For Example:
Код:
new Float:x = 52.352661, string[64];
format(string, 64, "x = %.2f", x);
Result = 52.35


Re: round a float val to certain value - Trooper[Y] - 14.06.2010

thanks alot,
//solved