import { round } from 'ngwr/utils';
round(0.1 + 0.2, 2); // 0.3
round(1.005, 2); // 1.01
round(7.4); // 7round
Rounds a number to a fixed number of decimals. Corrects float drift (1.005 to 1.01) only for values under 2.
Usage
API
| Name | Description | Type | Default |
|---|---|---|---|
round | Rounds value to decimals fraction digits. | (value: number, decimals = 0) => number | — |