Float round - 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)
+--- Thread: Float round (
/showthread.php?tid=409343)
Float round -
Scofield62 - 21.01.2013
Hey guys i need help with floats.
I would like to get a float with only one digit, for example.
I got a float eg: 0.324861 and I want to get with round digits to one -> 0.3.
Anyone know how can i do that?
Re: Float round -
LarzI - 21.01.2013
https://sampwiki.blast.hk/wiki/Floatround
Re: Float round -
Scofield62 - 21.01.2013
It is not good for me because it is round to integer i want to round to float but only with one digit.
Re: Float round -
LarzI - 21.01.2013
Quote:
Originally Posted by Scofield62
It is not good for me because it is round to integer i want to round to float but only with one digit.
|
Oh I apologise. I was mixing floatround with the C# function Math.Round, where you can specify decimals.
The only known way I can think of to do so atm is formatting a string with %.1f
Re: Float round -
Scofield62 - 21.01.2013
It worked Thank You!!