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?
Develop games in your browser. Powerful, performant & highly capable.
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?