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
I used toStringAsFixed() method , to round number to specific numbers after the decimal point EX : double num = 22.48132906 and when I rounded to two numbers like this : print(num.toStringAsFixed(2) ;
it printed 22.48
and when I rounded to one number .. printed 22.5