The decimal expansion of a real number is rounded when it is approximated by a terminating decimal that has a given number of decimal digits to the right of the decimal point.
Rounding to n decimal places is achieved by removing all decimal digits beyond (to the right of) the $$n^{th}$$ digit to the right of the decimal place, and adjusting the remaining digits where necessary.
If the first digit removed (the $${(n+1)}^{th}$$ digit) is less than 5 the preceding digit is not changed; for example, 4.02749 becomes 4.027 when rounded to 3 decimal places.
If the first digit removed is greater than or equal to 5, then the preceding digit is increased by 1; for example, 6.1234586 becomes 6.12346 when rounded to 5 decimal places.