iggs-utils - v2.4.0
    Preparing search index...

    Function getNearestLowMultiple

    • returns the nearest low multiple of a number, the result will always be less or equal to input number

      Parameters

      • n: number
      • multiple: number
      • precision: number = 0

      Returns number

      getNearestLowMultiple(17, 5) // 15
      getNearestLowMultiple(11, 2) // 10
      getNearestLowMultiple(8, 5) // 5
      getNearestLowMultiple(5, 2) // 4
      getNearestLowMultiple(5, 0) // 0
      getNearestLowMultiple(0.5, 0.2) // 0.4
      getNearestLowMultiple(0.7777777777777, 0.00001) // 0.7777700000000001 cause j♿ can't deal with decimal module
      getNearestLowMultiple(0.7777777777777, 0.00001, 5) // 0.77777