matician - v2.0.0
    Preparing search index...

    Function percentage

    • Calculates what percentage the 'part' is of the 'whole'.

      Parameters

      • part: number

        The portion of the whole.

      • whole: number

        The total or whole value.

      Returns number

      The percentage value of part relative to whole.

      Will throw an error if whole is 0.

      percentage(25, 100); // returns 25
      percentage(50, 200); // returns 25
      percentage(0, 100); // returns 0