Function decreaseByPercentage

  • Decrease a number by given percentage

    Parameters

    • value: string | number | bigint

      The number to decrease

    • percentage: string | number

      The percentage to decrease by

    • decimals: number

      The decimals of the value.

    Returns bigint

    The decreased number (e.g. 100 - 30% of 100 = 70)

    Example

    decreaseByPercentage('100', 10, 2) // 90
    decreaseByPercentage('100', 25, 2) // 75
    decreaseByPercentage(-100, 50, 9) // -150