How to round a float

Pulse 3 years ago updated by Minh-Tri Nguyen 3 years ago 2

I wnat to round to a specific number of decimals.

I'm using math round but rounds me to the nearest int. but I want it to display 2 decimals not the string (I'm not using math round to string).

Bolt Version:
Unity Version:
Scripting Backend:
.NET Version (API Compatibility Level):
Satisfaction mark by Pulse 3 years ago

Hi Pulse! Sorry for the late reply on this.

You can try this:

100 for 2 decimals, 1000 for 3 decimals, etc.

I made a macro for this and connected B input of both the multiply and divide, you can turn it into a MRound function similar to spreadsheet, which is quite useful i find.
Input: Value you want to round off
Value: Rounded to the nearest n-th, or multiple of n