Function round

Rounds a number.

If one parameter is given, it's the decimal places, and a rounding function is returned:

import { round } from 'https://unpkg.com/ixfx/dist/numbers.js';
const r = round(2);
r(10.12355); // 10.12

If two parameters are given, the first is decimal places, the second the value to round.

round(2, 10.12355); // 10.12
  • Parameters

    • decimalPlaces: number
    • v: number
    • OptionalroundUp: boolean

    Returns number

  • Parameters

    • decimalPlaces: number
    • OptionalroundUp: boolean

    Returns ((v: number) => number)

      • (v): number
      • Parameters

        • v: number

        Returns number