MFG Rounding Challenge

I’m pretty new to programming and I want to learn along using Unity. I found out that Mathf.Round doesn’t cover second argument to define decimal point

So the solution to this problem would be simply multiplying the number by 10 so you’d get 62.83 and that would get rounded to 63 and then divide that number by 0.1 so we would get 6.3

numberA = 6.283F;
Debug.Log(Mathf.Round(numberA * 10.0F) * 0.1F);

But I find this solution to be quite problematic (I think?) so I just used System library to get Math.Round that covers decimal point as a second argument

I have no idea if any of what I’ve just said makes any sense but hey, challenge complete! ^^’

2 Likes

Awesome job with the MFG challenge!

1 Like

Privacy & Terms