How do I Easily Round to x Decimal Places?

Get help using Construct 2

Post » Sun Sep 13, 2015 5:11 am

Hello readers.

I can't seem to find an easy way to round a float to a specified number of decimal places. For example, round(3.14159, 2) returns 3.14. Is there such an expression to do this in a similar manner or do I need to get tricksy? Perhaps regular expressions would do it? (But I don't really know how to use regex).

Help or advice, please?
B
4
Posts: 14
Reputation: 230

Post » Sun Sep 13, 2015 5:26 am

I was pointed to the suggestion:

"Try: round(N * 100) / 100
for 2 decimal places, or 1000 for 3 decimal places, etc... "

I hadn't thought of that. Ahh math. Is there anything you can't do?
B
4
Posts: 14
Reputation: 230


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 6 guests