Function roundDown

  • Round a given number down with a given precision. Shifts with exponential notation to avoid floating-point issues.

    Parameters

    • number: number

      the number to round.

    • precision: number = 0

      the number of decimal points.

    Returns number

    The rounded down number.

    Throws

    if the given number is not finite or NaN.

    Example

    roundDown(5.6789, 2);;
    //=> 5.67
    roundDown(5.6789);;
    //=> 5

Generated using TypeDoc