Skip to main content

roundValue

roundValue(value: number, decimals?: number): number;

Round a number to a specified number of decimal places. If decimals is not provided, the default precision (DEFAULT_PRECISION) is used.

ParameterTypeDescription
valuenumberThe number to round
decimalsnumber (optional)Number of decimal places (defaults to DEFAULT_PRECISION)

Example

// Round to 2 decimal places
soundManager.roundValue(3.14159, 2); // 3.14

// Round with default precision
soundManager.roundValue(3.14159); // 3.14 (or whatever DEFAULT_PRECISION is)