Given a double, I want to round it to a given number of points of precision after the decimal point, similar to PHP\'s round() function.
The closest thing I
void main() { int decimals = 2; int fac = pow(10, decimals); double d = 1.234567889; d = (d * fac).round() / fac; print("d: $d"); }
Prints: 1.23