# round

> Rounds to a fixed number of fraction digits, compensating floating point drift.

Source: https://ngwr.dev/reference/utils/round  
Kind: Util

## Usage

```angular-ts
import { round } from 'ngwr/utils';

round(0.1 + 0.2, 2); // 0.3
round(1.005, 2);     // 1.01
round(7.4);          // 7
```

## Why ngwr provides this

`Math.round((v) * 100) / 100` mis-rounds boundary values because of binary floating point — `1.005` becomes `1` instead of `1.01`. Adding `Number.EPSILON` before scaling fixes the boundary cases; the slider and input-number components rely on it for step math.

```angular-ts
// Native:
Math.round(1.005 * 100) / 100; // 1     ← wrong
// ngwr:
round(1.005, 2);               // 1.01
```

## API

| Name | Description | Type | Default |
| --- | --- | --- | --- |
| `round` | Rounds value to decimals fraction digits. | `(value: number, decimals = 0) => number` | `—` |
