Function roundUp

  • Round a given number up 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 number.

    Throws

    if the given number is not finite or NaN.

    Example

    roundUp(1.2345, 2);;
    //=> 1.23
    roundUp(1.2345);;
    //=> 2

Generated using TypeDoc