Rounds a floating point number to a specified number of decimal places.
Uses Math.round() internally to avoid floating point precision errors that can occur with direct decimal arithmetic.
For example, 5.2345 rounded to 2 decimal places becomes 5.23.
Rounds a floating point number to a specified number of decimal places.
Uses Math.round() internally to avoid floating point precision errors that can occur with direct decimal arithmetic.
For example, 5.2345 rounded to 2 decimal places becomes 5.23.
Example