Reducing the digits of a value

I have the following statement in my code, it displays a percentage value calculated.
the value currently has about 10 decimal places coming up but i dont want any, how can i adapt this code so that it doesn’t show any decimal places?

GUI.Label(new Rect(0, 100, 50, 50), System.Convert.ToString(Calculate(ace)) + “%”);

Whack this line after it:

Mathf.Round(yourVariableName);

thanks for trying dude! calculate is a method which calculates the percentage of the variable ace which can change all the time.

turns out whole number is making the % less accurate though is there a way to keep it down to just 1 or 2 decimal places?

What is the value of ace, and what does Calculate do?

Assuming that the result is just a long decimal or float, try this…

GUI.Label(new Rect(0, 100, 50, 50), System.Convert.ToString(Mathf.Round(Calculate(ace))) + “%”);

or

GUI.Label(new Rect(0, 100, 50, 50), System.Convert.ToString(Mathf.Floor(Calculate(ace))) + “%”); to just truncate the decimals

Hope this helps,
-Larry