Search code examples
c#rounding.net-micro-framework

.NET Micro framework Rounding


Hey I have just a quick question here. Working with the joystick input, and putting it on an LCD screen, however, I am trying to take the X and Y values and round them to the nearest hundredth. However, within the .NET Micro, System.Math.Round() only takes 1 argument, and therefore only rounds to the nearest integer.

Therefore, I cannot go System.Math.Round(joystick.GetPosition().X, 2) without getting the error "No overload for method 'Round' takes 2 arguments".

Is there another way of doing this? Thanks in advance!


Solution

  • You can try Multiplying your value by 100, round and then divide the result by 100.