Rounding Challenge

6.283

Floor rounding = 6
Ceiling rounding = 7
Rounding to 1 decimal place = 6.3
Rounding to 2 decimal places = 6.28

3 Likes

Great job :clap:

1 Like

With Visual Studio C#, Mathf is the function for a float number… But the Mathf.Round dont have the possibility to include decimals, so in this case what operation needs to be done ?

@Carlos_Latorre, if you need to use something with more precision than a float, try using the System.Math library.

System.Math.Round can take both double and decimal data types and also gives you the ability to specify the type of midpoint rounding you want to use.

If you look at the actual implementation of Mathf.Round in Unity then you’ll find that it’s really just calling System.Math.Round for you and converting the result to a float.